[Haskell-cafe] The type class wilderness + Separating instances and implementations into separate packages

Bas van Dijk v.dijk.bas at gmail.com
Thu Nov 3 15:43:01 CET 2011

On 3 November 2011 14:56, Ryan Newton <rrnewton at gmail.com> wrote:
>> Aside: The problem with collections is that we don't have the programming
>> language means to do this well yet (although soon!). The issue is that we
>> want to declare a type class where the context of the methods depends on the
>> instance e.g.
>> class MapLike m where
>>     type Ctx :: Context  -- Can't do this today!
>>     insert Ctx => k -> v -> m -> m
>> Java et all cheats in their container hierarchy by doing unsafe casts (i.e.
>> they never solved this problem)!
> Ah, interesting.  Is there a proposal to do this?

Even better: it's already implemented by Max Bolingbroke and will be
in ghc-7.4! See:


So be patient and wait for your Christmas present ;-)


More information about the Haskell-Cafe mailing list