Hi.

On 21 July 2013 17:23, martin <martin.drautzburg@web.de> wrote:
I just want to insert several key/value pairs, something like

Map.empty
insert key1 val1
insert key2 val2
return theMap

If you really want this syntax, what about using the writer monad:

import Control.Monad.Writer
import qualified Data.Map as M

m = execWriter $ do
    insert 1 "foo"
    insert 2 "bar"
    where insert k v = tell (M.singleton k v)
-- m = fromList [(1,"foo"),(2,"bar")]


Hope this helps,
Ozgur