[Haskell-cafe] Please tell me this function exists

Daniel Fischer daniel.is.fischer at web.de
Wed Dec 17 13:43:23 EST 2008


Am Mittwoch, 17. Dezember 2008 19:36 schrieb Brian Hurt:
> I know it's not hard to write, but still:
>
> concat :: String -> [String] -> String
> concat _ [] = ""
> concat _ [x] = x
> concat sep x:xs = x ++ sep ++ (concat sep xs)
>
> I've got to be stupid and missing it in the standard libraries.  Please
> tell me where.  Thanks.
>
> Brian

Data.List.intersperse and concat together do exactly that:

yourconcat === (concat .) . intersperse


More information about the Haskell-Cafe mailing list