RFC: Should Data.IntMap.Strict be value-strict in the function arguments or the map itself

Milan Straka fox at ucw.cz
Thu Oct 27 19:24:35 CEST 2011


> On Thu, Oct 27, 2011 at 10:17 AM, Edward Z. Yang <ezyang at mit.edu> wrote:
> 
> > Here's the definition of Tip.
> >
> >    data IntMap a = Bin {-# UNPACK #-} !Prefix {-# UNPACK #-} !Mask !(IntMap
> > a) !(IntMap a)
> >                  | Tip {-# UNPACK #-} !Key a
> >                  | Nil
> >
> 
> You're right. I forgot the definition of the data type itself. I guess
> there's no function in the API currently that takes a key parameter and
> isn't strict in that parameter because the key is either
> 
>  * compared to another key, or
>  * inserted into the map
> 
> which both causes the key to be evaluated.

I believe

delete undefined Nil

does not terminate with current definition, but would terminate
if the explicit seq would not be present.

Cheers,
Milan



More information about the Libraries mailing list