[Haskell-cafe] restricted existential datatypes

Ralf Lammel Ralf.Lammel at microsoft.com
Tue Jan 9 23:46:09 EST 2007


Misha,

This feels like you would compose dictionary types in heterogeneous lists and then have a type-driven lookup from the dictionary list; this would be very similar to the lookup operation for TICs in the HList lib, only that the driving type is of kind *->* and that the traversing instances eventually need to be constrained by the Sat constraint for the driving type. Do you think, this could work?

Best,
Ralf

> > f :: (Contains cxt ShowCxt) => Box cxt -> String
> > f (Box a) = show a
>
>   The type is meant to say that the context of the box must contain
> Show
> as one of the classes. I would imagine the Contains class to be
> something like
>
> > class Contains cxt subCxt where
> >   subDict :: cxt a -> subCxt a



More information about the Haskell-Cafe mailing list