Discussion: Strict maps

Heinrich Apfelmus apfelmus at quantentunnel.de
Tue Dec 23 10:25:34 UTC 2014


Milan Straka wrote:
> Hi all,
> 
> here is the discussion that initiated the Lazy and Strict versions:
> https://www.haskell.org/pipermail/libraries/2011-May/016362.html
> 
> What follows is only my own interpretation of the discussion, please
> feel to reed it by yourselves. There were few people discussing, but
> I feel that avoiding the distinction on a type level was quite
> supported. I advocated the idea that strictness is not a property of the
> map itself, but a property of how you work with the map. The flexibility
> of one data type at the expense of some static checking was mentioned.

I may be somewhat late for the discussion, but I would advocate for the 
contrary point of view, that "strictness" *is* a property of the map. I 
would also say that "strictness" is not the right word (hence the 
quotes). Rather, the maps from `Data.Map.Strict` are characterized by 
the invariant that whenever such a map is in WHNF, then all its values 
are in WHNF, too. The type system seems like the right place to encode 
such invariants.

For a more detailed discussion of this approach, see also

   http://apfelmus.nfshost.com/blog/2013/08/21-space-invariants.html

I discuss an actual use case at the end.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Libraries mailing list