Propsal: NoDatatypeContexts

Christian Maeder Christian.Maeder at dfki.de
Tue Jul 20 04:46:17 EDT 2010


Christian Maeder schrieb:
> Ian Lynagh schrieb:
[...]
>>     http://hackage.haskell.org/trac/haskell-prime/wiki/NoDatatypeContexts
> 
> 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.

It would be interesting to know (or if at all) i.e. uniplate (proposed
for the haskell platform) or other generic stuff can handle this case
(as alternative to DrIFT).

A short look at http://www.haskell.org/haskellwiki/Uniplate did not
immediate help on this matter.

Template Haskell may be possible, too.

Can some expert for generic programming elaborate on this? (I once had a
good paper comparing the various approaches, but I can no longer find it.)

Pointers are welcome.

Cheers Christian

> 
> 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