Proposal: Value strict versions of containers

Simon Marlow marlowsd at
Mon May 23 11:47:55 CEST 2011

On 22/05/2011 11:58, Milan Straka wrote:
>> Excerpts from Milan Straka's message of Sun May 22 06:50:07 -0400 2011:
>>> - the types Data.IntMap.IntMap, Data.IntMap.Lazy.IntMap and
>>>    Data.IntMap.Strict.IntMap should be equal -- so I can use strict
>>>    methods on IntMap someone else created with lazy methods. That is
>>>    simple in absence of type classes.
>> Comment: This would mean you would get no static assurances against
>> mixing up a strict IntMap with a lazy IntMap; for all intents and purposes,
>> this is equivalent to implementing strict versions of all functions on top
>> of a lazy data type.
> Exactly.
> 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.
> But maybe others feel differently.

I like your proposal.  If the two were different types, I'm fairly sure 
we would end up needing strict operations on the lazy IntMap 
occasionally.  Making the two types equivalent adds some useful 
flexibility at the expense of some static checking - it's a tradeoff, 
and reasonable people could differ on which they prefer, but I 
personally would rather have one IntMap with strict and lazy APIs.


More information about the Libraries mailing list