(if i==0 then sb else sb << sep) <+ l!i
loop (i+1)
-"Joins the string representations of the list of values with the given separator."
+"""
+Joins the string representations of the list of values with the given separator.
+
+See [intercalate](#intercalate) for an alternative that works with Strings
+and doesn't escape its arguments.
+"""
joinWithSeparator :: Show a => String -> [a] -> String
joinWithSeparator separator values = runProc (
StringBuilder.toString $ printWithSeparator StringBuilder.new separator values)
+"""
+The intercalate function takes a String and a list of Strings
+and concatenates the list after interspersing the first argument
+between each element of the list.
+
+See also more generic [joinWithSeparator](#joinWithSeparator)
+which escapes its arguments using `show`.
+"""
intercalate :: String -> [String] -> String
intercalate separator strings = do
l = length strings