Propsal: NoDatatypeContexts

Christian Maeder Christian.Maeder at
Mon Jul 19 05:29:37 EDT 2010

Ian Lynagh schrieb:
> Hi all,
> 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).
> More details are on the proposal wiki page:

I'm for this proposal, although I've got an example where I need this
context, namely for DrIFT to derive a proper context for instances.

DrIFT doesn't know that the Read instance for Data.Set.Set relies on Ord
of the elements. For

data Ord symbol => ExtSign sign symbol = ExtSign
  { plainSign :: sign
  , nonImportedSymbols :: Set.Set symbol
  } deriving Show

DrIFT cannot derive the Read (or our deserialization) instance without
the "Ord symbol =>" context.

However, ghc is able by "deriving (Show, Read)" to see

instance (Ord symbol, Read sign, Read symbol) =>
         Read (ExtSign sign symbol)

without the context.

Cheers Christian

More information about the Haskell-prime mailing list