
23 May
2011
23 May
'11
8:14 a.m.
On Mon, May 23, 2011 at 1:31 PM, Sebastian Fischer
I am also in favour of the "same type approach" because it seems it can help to avoid duplicating the implementations. Would it be efficient to define a type Data.IntMap.Strict.IntMap with strict fields (also for values) and then define Data.IntMap.Lazy in terms of this implementation and a wrapper type? data Lazy a = Lazy { getLazy :: a } newtype IntMap a = LazyIntMap { getLazyIntMap :: Data.IntMap.Strict (Lazy a) } lookup :: Int -> IntMap a -> Maybe a lookup n = fmap getLazy . Data.IntMap.Strict.lookup n . getLazyIntMap
Not really, it adds two words worth of overhead and one extra indirection. Johan