Proposal: Value strict versions of containers

Johan Tibell johan.tibell at gmail.com
Sun May 22 13:07:13 CEST 2011


On Sun, May 22, 2011 at 12:58 PM, Milan Straka <fox at ucw.cz> wrote:
> Do you think we should have different types for static and lazy maps?
> It feels odd to me to have these distinguished on type level.
> To me it is more about how you want to work with the structure, not the
> structure itself.

I've thought about this issue as well. At the moment
Data.HashMap.Strict just provides wrappers around the functions in
Data.HashMap.Lazy. Two implications of this is that all instances are
shared (so a HashMap from Data.HashMap.Strict still behaves like a
lazy map when used through class instances) and that it's a bit
trickier to get strictness right (while it falls out almost
automatically if you make the type itself strict). I also think
there's a small performance implication of having the type itself
strict, in that GHC never will have to check if the value is
evaluated. I need to investigate this some more though.

Cheers,
Johan



More information about the Libraries mailing list