[Haskell-cafe] Documenting strictness properties for Data.Map.Strict

Johan Tibell johan.tibell at gmail.com
Fri Nov 18 17:10:10 CET 2011

On Fri, Nov 18, 2011 at 1:58 AM, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
> Johan Tibell wrote:
>>       map (\ v -> undefined)  ==  undefined
>>       mapKeys (\ k -> undefined)  ==  undefined
> Not really related to the question but I don't really understand how these
> properties can possibly hold. Shouldn't it be:
>  map (\v -> undefined) x = undefined
> And even then, does this really hold for empty maps?

It doesn't hold. It needs the side condition that the map is initially
empty. I wonder if there's any function in the API that'd let me
express this property (of HOFs) that doesn't require a side condition.
I don't think so e.g.

    insertWith (\old new -> undefined) k v m

has a side condition that k is in the map.

-- Johan

More information about the Haskell-Cafe mailing list