#1171: GHC doesn't respect the imprecise exceptions semantics
----------------------+-----------------------------------------------------
 Reporter:  neil      |          Owner:          
     Type:  bug       |         Status:  reopened
 Priority:  low       |      Milestone:  _|_     
Component:  Compiler  |        Version:  6.6     
 Severity:  normal    |     Resolution:          
 Keywords:            |     Difficulty:  Unknown 
 Testcase:  cg059     |   Architecture:  Multiple
       Os:  Multiple  |  
----------------------+-----------------------------------------------------
Comment (by Isaac Dupree):

 Stefan O'Rear happened to write in haskell-cafe a performance reason for
 allowing non-termination to throw any exception:

 "When you see an expression of the form:

 f a

 you generally want to evaluate a before applying; but if a is _|_, this
 will only give the correct result if f a = _|_.  Merely 'guaranteed to
 evaluate' misses out on some common cases, for instance ifac:
 {{{
 ifac 0 a = a
 ifac n a = ifac (n - 1) (a * n)
 }}}
 ifac is guaranteed to either evaluate a, or go into an infinite loop -
 so it can be found strict, and unboxed.  Whereas 'ifac -1 (error "moo")'
 is an infinite loop, so using a definition based on evaluation misses
 this case."

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1171#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to