Forked from ujihisa/split implementations in Haskell.hs
Created
October 10, 2011 02:29
-
-
Save ujihisa/1274512 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 Text.Parsec as P | |
main = do | |
print $ ", hello, world,!" `split` ", " | |
t `split` b = case P.parse (split' (P.string b)) "split" t of Right x -> x | |
split' b = P.anyChar `P.manyTill` (P.eof P.<|> (P.try b >> return ())) `P.manyTill` P.eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment