Because insertWith has a different type than your code needs.
It's hard to improve on a 20 line Awk program for generating text but I thought it would be fun to investigate a Haskell solution.Why can't I cons an element onto an existing list?MichaelPrelude Data.List Data.Map> insertWith (:) ("Moby", "Dick") "will" (fromList [(("Joe", "Blow"),["is"]), (("Moby", "Dick"),["may"])])<interactive>:1:11:Occurs check: cannot construct the infinite type: a = [a]Expected type: aInferred type: [a]In the first argument of `insertWith', namely `(:)'In the expression:insertWith(:)("Moby", "Dick")"will"(fromList [(("Joe", "Blow"), ["is"]), (("Moby", "Dick"), ["may"])])Prelude Data.List Data.Map>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe