Skip to content

Instantly share code, notes, and snippets.

Last active Dec 4, 2020
What would you like to do?
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