[Haskell-cafe] Re: GADTs and Scrap your Boilerplate

John Creighton johns243a at gmail.com
Tue May 18 18:27:07 EDT 2010



On May 18, 11:57 am, Oscar Finnsson <oscar.finns... at gmail.com> wrote:
> > forall d.   gunfold k z c = k (z (DataBox::d->DataBox d))
>
> Didn't work either. :(

I looked again at the paper (page 27):
Haskell's Overlooked object system.
http://homepages.cwi.nl/~ralf/OOHaskell/paper.pdf

I think the forall is suppose to be in the constructor (as opposed to
where I put it) and I don't think you need algebraic datatypes.

data DataBox = forall d. (Show d, Eq d, Data d) => DataBox d

I am not sure if this requires any extensions. Try it with and without
the extension "explcit forall"

You can also try this with a class called MakeDataBox and make d an
instance of make data box.

good luck.


More information about the Haskell-Cafe mailing list