Please tell me this function exists

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

Hoogle is your friend:
Searching for String -> [String] -> String
Data.List intercalate :: [a] -> [[a]] -> [a]
base
intercalate xs xss is equivalent to (concat (intersperse xs xss)). It
inserts the...
Regards,
Max
On Wed, Dec 17, 2008 at 10:36 AM, 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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Wed, Dec 17, 2008 at 7:36 PM, 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.
Just hoogle the type: http://haskell.org/hoogle/?hoogle=String+-%3E+[String]+-%3E+String and see the first hit. regards, Bas

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

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
I just remembered Data.List.intercalate.

On 18 Dec 2008, at 7:36 am, Brian Hurt wrote:
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.
You want concat (intersperse sep strings) using functions from List.
participants (5)
-
Bas van Dijk
-
Brian Hurt
-
Daniel Fischer
-
Max Rabkin
-
Richard O'Keefe