Data.Map, Data.Set working together

Adrian Hey ahey at
Fri Apr 8 03:50:12 EDT 2005

On Wednesday 06 Apr 2005 8:54 am, Tomasz Zielonka wrote:
> > BTW, in the ghc survey I asked the ghc folk for type specialisation to
> > allow unboxing in polymorphic data types.  Dunno when they're going to
> > deliver that though :-)
> I am not sure I fully understand, but if I do, it would be a nice
> feature.

Useage would be something like this perhaps..

newtype IAVL a = IAVL (AVL (# Int# , a #))

mapIAVL :: (a -> b) -> IAVL a -> IAVL b
mapIAVL f (IAVL iavl) = IAVL (mapAVL (\(# i, a #) -> (# i, f a #)) iavl)

So I'd still have to create a distinct type and distinct functions for
operating on that type. But those new functions would usually be simple
one liners which re-use the fully polymorphic definitions (mapAVL in
this example).

But I think this or something similar this will be difficult in practice.

Adrian Hey

More information about the Libraries mailing list