
28 Sep
2010
28 Sep
'10
4:08 a.m.
Johan said:
Is there a reason not to have monadic version of the functions in containers? I've a need for functions of type:
Ack! Haskell needs effect polymorphism. The API already has 150 functions. How many more do we need to add if we want to cover all the monadic versions?
If the number of functions becomes a concern we can be effective and still conservative. Take Data.Map as an example, we can make updateLookupWithKeyM and omit alterM, alterWithKeyM, insertLookupWithKeyM, etc as those can be built using updateLookupWithKeyM - no power lost. This strategy might cut the number of functions down from ~2 dozen to a bare handful ( I expect a 'map' variant will be sensible, probably one or two others). Cheers, Thomas