[Haskell-cafe] Very Small Program
Jason Dagit
dagit at eecs.oregonstate.edu
Thu Nov 2 00:45:14 EST 2006
Hello,
I just found it (in ghci and hugs) that this is a valid haskell program:
let 0 = 1 in 0
This program evaluates to 0 (to my surprise).
I expected something similar to how this works:
let { 1 + 1 = 3; 3 + 1 = 7 } in 1 + 1 + 1
Where you get 7.
So, if the 0 is not used as an identifier (ie, defining a function or
name of a value), then why doesn't this count as a parse error? And,
why didn't I get to locally redefine it?
Thanks,
Jason
More information about the Haskell-Cafe
mailing list