Concrete syntax for pattern synonym type signatures

Richard Eisenberg eir at cis.upenn.edu
Mon Nov 10 03:02:53 UTC 2014


On Nov 9, 2014, at 2:11 PM, Simon Peyton Jones <simonpj at microsoft.com> wrote:
> 
> * One other possibility would be two => thus
> 	pattern P :: (Eq b) => (Num a, Eq a) => ...blha...
> 

I should note that I can say this in 7.8.3:

foo :: Show a => Eq a => a -> String
foo x = show x ++ show (x == x)

Note that I've separated the two constraints with a =>, not a comma. This syntax does what you might expect. (I actually believe that this is an improvement over the conventional syntax, but that's a story for another day.) For better or worse, this trick does not work for GADT constructors (which is a weird incongruence with function type signatures), so adding the extra arrow does not really steal syntax from GADT pattern synonyms.

Richard


More information about the ghc-devs mailing list