Changes between Version 6 and Version 7 of BangPatterns


Ignore:
Timestamp:
Nov 19, 2007 10:38:26 AM (6 years ago)
Author:
simonpj@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BangPatterns

    v6 v7  
    247247not bang-patterns.   Remember, the bang is part of the binding, not the pattern, 
    248248 
     249== Tricky point: exceptions == 
     250 
     251Consider this program 
     252{{{ 
     253test = "no exception" 
     254   where !_ = error "top down" 
     255         !_ = error "bottom up" 
     256 
     257eval_order = evaluate test `catch` \e -> 
     258               case e of 
     259                 ErrorCall txt -> return txt 
     260                 _             -> throw e 
     261}}} 
     262Depending on whether the strict bindings induced by the bang patters in `test` are evaluated top-to-bottom or bottom-to-top, you'll get different results from `eval_order`.  But this is exactly the point of of the [http://research.microsoft.com/%7Esimonpj/Papers/imprecise-exn.htm Imprecise Exceptions paper]: the semantics of `test` is a set of exception values, rather than a unique one.  So this non-determinism (which can only be observed in the IO monad) is fine. 
     263 
     264See this [http://article.gmane.org/gmane.comp.lang.haskell.general/15751 email thread] 
     265 
    249266== Tricky point: nested bangs (part 1) == 
    250267