I have the following function using the scalaz |+| operator:
def sumGames(games: List[Map[String, Int]]) =
games.foldLeft(_ |+| _)
Adding two maps manually works flawlessly (a: Map[String, Int) |+| b: Map[String, Int]), but declaring the above function yields 3 errors:
<console>:20: error: missing parameter type for expanded function ((x$1, x$2) =>
x$1.$bar$plus$bar(x$2))
games.foldLeft(_ |+| _)
^
<console>:20: error: missing parameter type for expanded function ((x$1: <error>
, x$2) => x$1.$bar$plus$bar(x$2))
games.foldLeft(_ |+| _)
^
<console>:20: error: missing arguments for method foldLeft in trait LinearSeqOpt
imized;
follow this method with `_' if you want to treat it as a partially applied funct
ion
games.foldLeft(_ |+| _)
Why doesn't this work and how can I fix this?