[Haskell-cafe] Documenting strictness properties for Data.Map.Strict
johan.tibell at gmail.com
Fri Nov 18 06:44:32 CET 2011
On Thu, Nov 17, 2011 at 9:21 PM, Johan Tibell <johan.tibell at gmail.com> wrote:
> I'm not entirely happy with this formulation. I'm looking for
> something that's clear (i.e. precise and concise, without leaving out
> important information), assuming that the reader already knows how
> lazy evaluation works at a high level.
This reads a bit better to me:
This module is strict in keys and values. In particular,
* key and value function arguments passed to functions are
evaluated to WHNF before the function body is evaluated, and
* keys and values returned by high-order function arguments are
evaluated to WHNF before they are inserted into the map.
Here are some examples:
insertWith (+) k undefined m == undefined
delete undefined m == undefined
map (\ v -> undefined) == undefined
mapKeys (\ k -> undefined) == undefined
Any ideas for further improvements?
More information about the Haskell-Cafe