Skip to content

Instantly share code, notes, and snippets.

@Sh4pe
Last active March 7, 2017 21:39
Show Gist options
  • Save Sh4pe/e23cd57fdcd32aaab428cc93465f8542 to your computer and use it in GitHub Desktop.
Save Sh4pe/e23cd57fdcd32aaab428cc93465f8542 to your computer and use it in GitHub Desktop.
concatLeft :: Char -> C.ByteString -> C.ByteString
concatLeft delim a = go $ C.uncons a
where bsa = C.singleton delim
go Nothing = bsa
go (Just (delim, r)) = concatLeft delim r
go (Just (x, r)) = C.concat [bsa, r]
-- Warning:
-- Pattern match(es) are overlapped
-- In an equation for ‘go’: go (Just (x, r)) = ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment