Curious behaviour of irrefutable pattern.

Simon Peyton-Jones simonpj at microsoft.com
Thu Dec 21 16:32:23 EST 2006


| Do you mean if I have both an infinite loop and an error call, then I
| might get only the loop?

Absolutely.

f x = error "urk"
loop n = loop (n+1)
main = print (f (loop 0))

The compiler figures out that f is strict, and uses call by value.  Result is a loop.

Simon


More information about the Glasgow-haskell-users mailing list