[Haskell-beginners] How to avoid repeating a type restriction from a data constructor

gs voldermort at hotmail.com
Thu Apr 25 10:03:25 CEST 2013


Daniel Fischer <daniel.is.fischer <at> googlemail.com> writes:

> ...

You've mentioned GADT a few times, but I can't find a case where it's
different to regular datatypes.

data Foo a = Eq a => Foo a

seems to have the same effect as

data Foo a where
   Foo a :: Eq a => a -> Foo a

Both remember the Eq constraint if I pattern match on the constructor, and
both ignore it otherwise.




More information about the Beginners mailing list