Curious behaviour of irrefutable pattern.
m at ryangunter.com
Fri Dec 22 10:12:25 EST 2006
Bernie Pope <bjpop at csse.unimelb.edu.au> writes:
> Mike, what do you mean by "willy nilly convert my error calls to
Simon Peyton-Jones <simonpj at microsoft.com> writes:
> In general, GHC (like every other compiler that does strictness analysis) feels free to change non-termination into a call to 'error' and vice versa. One could change that, but a lot of programs would become less efficient as a result.
I was concerned by the "vice versa" conversion--from an error call to
non-termination. If more than one bottoms (say, a non-termination and
an error call) are present in my program, I'm fine with getting any
one of them. If I have only an error call, though, I do want to see
an error message. An infinite loop would be unhelpful. So, I would
consider it an unfriendly "willy nilly" convertion for GHC to generate
import System.Environment ( getArgs )
main = getArgs >>= putStrLn . head
that failed to terminate when I passed no command-line arguments.
More information about the Glasgow-haskell-users