On 09.02.2011 20:57, Chris Smith wrote:
On Wed, 2011-02-09 at 18:15 +0100, Cristiano Paris wrote:
I've a type problem that I cannot solve and, before I keep banging my
head against an unbreakable wall, I'd like to discuss it with the
list.

If I'm understanding your high-level goals correctly, then you're going
about things the wrong way.  It looks like in your "Sealed" type, you're
accumulating a list of type class constraints that are needed by a
phantom type, in order to access the value.  But type classes are open;
anyone can make any new type an instance of the type class whenever they
want.


It's possible to have closed type classes. Trick consist in adding unsatisfiable constraint. For example:

> -- This type class is not exported
> class Private a
> class Private a => PRead a

If Private is not exported one cannot add instances to PRead.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to