[Haskell-cafe] Please add a method for optimized concat to the Semigroup class

Stephen Tetley stephen.tetley at gmail.com
Tue May 3 14:03:46 CEST 2011


There is that formulation, though usually I find I need to do it with
an alternative instead:


altconcat alt []     = alt
altconcat _   (a:as) = go a as
  where
    go acc [] = acc
    go acc (b:bs) = go (acc <> b) bs

Both are "kind of, sort of" bringing you up to a Monoid though...

On 3 May 2011 12:56, Holger Siegel <holgersiegel74 at yahoo.de> wrote:

> You have to provide the "neutral" element by yourself:



More information about the Haskell-Cafe mailing list