
21 Jul
2013
21 Jul
'13
6:44 p.m.
On Mon, Jul 22, 2013 at 12:06 AM, martin
It seems like fromList is as pretty as it gets. Actually it is not that bad.
Agreed. What you might want to look into is the difference between /expressions/ and imperative statements, also known as /commands/. The effectful nature of commands is typically modeled in Haskell using monads, which may explain your references to do-notation and chaining functions. The mapping operations you're asking about can be easily /described/ using expressions, so monads don't need to enter the picture. Minimize effects whenever possible. E.g.
m0 = fromList [(key1,val1),(key2,val2)] m1 = m0 <> fromList [(key3,val3),(key4,val4)]
-- Kim-Ee