[Haskell-cafe] Synthetic values?

Bas van Dijk v.dijk.bas at gmail.com
Wed Feb 9 20:37:08 CET 2011

On 9 February 2011 19:33, Alexey Khudyakov <alexey.skladnoy at gmail.com> wrote:
> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

Indeed, this is exactly what I use in explicit-iomodes:



More information about the Haskell-Cafe mailing list