<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-09-30 20:10 GMT+02:00 David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">The Eq constraint is needed to support pattern matching, the raison d’être of pattern synonyms.</p></blockquote><div>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:</div><div><br></div><div>    \x -> case x of 1234 -> undefined :: (Eq a, Num a) => a -> r</div><div><br></div><div>This makes sense now, and there is no magic involved. :-]</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">I'm pretty sure the reason you need ScopedTypeVariables for your second example is that GHC only allows pattern signatures with that extension enabled.</p></blockquote><div>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.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr"> Once upon a time there was a separate PatternSignatures extension, I believe, but not any more.</p></blockquote><div>Never heard of that one...</div></div></div></div>