[Haskell-beginners] Syntactic sugar to insert into a Map?
ky3 at atamo.com
Mon Jul 22 00:44:02 CEST 2013
On Mon, Jul 22, 2013 at 12:06 AM, martin <martin.drautzburg at web.de> wrote:
> 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
The mapping operations you're asking about can be easily /described/ using
expressions, so monads don't need to enter the picture. Minimize effects
> m0 = fromList [(key1,val1),(key2,val2)]
> m1 = m0 <> fromList [(key3,val3),(key4,val4)]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners