
23 May
2011
23 May
'11
7:31 a.m.
On Mon, May 23, 2011 at 11:47 AM, Simon Marlow
I personally would rather have one IntMap with strict and lazy APIs.
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 ... Sebastian