<p dir="ltr">The Eq constraint is needed to support pattern matching, the raison d’être of pattern synonyms. I'm pretty sure the reason you need ScopedTypeVariables for your second example is that GHC only allows pattern signatures with that extension enabled. Once upon a time there was a separate PatternSignatures extension, I believe, but not any more.</p>
<div class="gmail_quote">On Sep 30, 2015 2:04 PM, "Sven Panne" <<a href="mailto:svenpanne@gmail.com">svenpanne@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The type of a pattern synonym like<div><br></div><div>   pattern FOO = 1234</div><div><br></div><div>seems to be '(Eq a, Num a) => a', which makes partially makes sense, although it's not immediately clear to me where the 'Eq a' part comes from. But probably that would be clear if I read the desugaring rules closely enough. ;-) My real question is about:</div><div><br></div><div><div>   pattern FOO = 1234 :: Int</div></div><div><br></div><div>This doesn't compile out of the box, GHC seems to require ScopedTypeVariables, too:</div><div><br></div><div><div>    Illegal type signature: `Int'</div><div>      Perhaps you intended to use ScopedTypeVariables</div><div>    In a pattern type-signature</div></div><div><br></div><div>Why is this the case? From a user perspective, the error is totally bogus, there are no visible type variables at all. Can GHC be fixed to avoid enabling ScopedTypeVariables?</div><div><br></div><div>Cheers,</div><div>   S.</div><div><br></div></div>
<br>_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users</a><br>
<br></blockquote></div>