Last active
December 4, 2020 07:06
-
-
Save dmjio/46433d7f23737095a58b07a21453d197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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