17 Jun
2014
17 Jun
'14
7:05 p.m.
On Tue, Jun 17, 2014 at 12:51 PM, Roman Cheplyaka
* Alexey Muranov
[2014-06-17 03:25:10-0700] Is this the expected behavior that
1 = 0
does not raise any error? What does this mean?
1 is a valid (nullary) pattern, so yes. This pattern binding obviously fails.
Prelude> let x@1 = 0 Prelude> x *** Exception: <interactive>:2:5-11: Irrefutable pattern failed for pattern x@1
It doesn't even have to fail, since numeric literals are overloaded: instance Num () where fromInteger _ = () v :: () v = let x@1 = 0 in x
v ()
Erik