[Haskell-cafe] 1 = 0?

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Tue Jun 17 10:54:27 UTC 2014


On Tue, Jun 17, 2014 at 03:25:10AM -0700, Alexey Muranov wrote:
> Is this the expected behavior that
> 
>     1 = 0
> 
> does not raise any error?  What does this mean?

I guess it's an irrefutable pattern match that doesn't bind any variables,
so you can never see it fair.  Cf

    Prelude> let (x, 1) = (2,3)
    Prelude> x
    *** Exception: <interactive>:7:5-18: Irrefutable pattern failed for pattern
    *** (x, 1)
    Prelude> let (x, 3) = (2,3)
    Prelude> x
    2

I'll let someone more knowledgeable comment on why it's a good idea not to
prevent this kind of thing.

Tom
 


More information about the Haskell-Cafe mailing list