Propsal: NoDatatypeContexts

Malcolm Wallace malcolm.wallace at me.com
Tue Jul 20 14:47:34 EDT 2010


> H98 and H2010 allow a context to be given for datatypes, e.g. the
> "Eq a" in
>
>    data Eq a => Foo a = Constr a
>
> I have made a proposal to remove support for that context (ticket  
> #139).

Although I would prefer that contexts of datatypes did the right and  
useful thing, in the absence of a proposal of that nature, I am quite  
happy to add my +1 to their removal instead.

As Igloo notes, GADTs are a more viable way to achieve the storing of  
the dictionary within the constructor, e.g.

     data OrdTree a where
         Leaf   ::          a -> OrdTree a
         Branch :: Ord a => OrdTree a -> OrdTree a -> OrdTree a

Regards,
     Malcolm



More information about the Haskell-prime mailing list