[Haskell-cafe] Why were datatype contexts removed instead of "fixing them"?

Joe Quinn headprogrammingczar at gmail.com
Thu Apr 25 13:36:50 CEST 2013

 From what I have heard, they are completely subsumed by GADTs, which is 
a stable enough extension that it was considered unimportant to save.

Your Foo would be something like this:

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

On 4/25/2013 6:38 AM, harry wrote:
> If I understand correctly, the problem with datatype contexts is that if we
> have e.g.
>    data Eq a => Foo a = Foo a
> the constraint Eq a is thrown away after a Foo is constructed, and any
> method using Foos must repeat Eq a in its type signature.
> Why were these contexts removed from the language, instead of "fixing" them?
> PS This is following up on a discussion on haskell-beginners, "How to avoid
> repeating a type restriction from a data constructor". I'm interested in
> knowing whether there's a good reason not to allow this, or if it's just a
> consequence of the way type classes are implemented by compilers.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list