Skip to content

Instantly share code, notes, and snippets.

@dmjio
Last active December 4, 2020 07:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dmjio/46433d7f23737095a58b07a21453d197 to your computer and use it in GitHub Desktop.
import qualified Data.ByteString as B
import Data.ByteString (ByteString)
splitOn' :: ByteString -> ByteString -> [ByteString]
splitOn' del bs | B.null bs = []
splitOn' del bs =
case B.breakSubstring del bs of
(ls, rest) ->
if B.null rest
then ls : mempty
else ls : splitOn' del (B.tail rest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment