2015-09-30 20:10 GMT+02:00 David Feuer <david.fe...@gmail.com>:

> The Eq constraint is needed to support pattern matching, the raison d’être
> of pattern synonyms.
>
I was just a bit confused by the fact that normally you don't need an 'Eq
a' constraint for pattern matching. But looking at the Haskell report, one
can see that matching against numeric/char/string literals involves (==),
so:

    \x -> case x of 1234 -> undefined :: (Eq a, Num a) => a -> r

This makes sense now, and there is no magic involved. :-]

> I'm pretty sure the reason you need ScopedTypeVariables for your second
> example is that GHC only allows pattern signatures with that extension
> enabled.
>
My main question is: Why is this the case? Is it really necessary in our
simple example? The GHC docs should probably mention the magic behind this
in the patter synonym section.


> Once upon a time there was a separate PatternSignatures extension, I
> believe, but not any more.
>
Never heard of that one...
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users

Reply via email to