Created
August 3, 2017 13:02
-
-
Save freakingawesome/62046eb6a24d4c4f5bc0103f83317e40 to your computer and use it in GitHub Desktop.
so-45484832
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
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help | |
Loaded GHCi configuration from C:\Users\CHAD~1.GIL\AppData\Local\Temp\ghci34580\ghci-script | |
Prelude> import Text.Parsec | |
Prelude Text.Parsec> import Text.Parsec.String | |
Prelude Text.Parsec Text.Parsec.String> :{ | |
Prelude Text.Parsec Text.Parsec.String| parsePair :: Parser (String, String) | |
Prelude Text.Parsec Text.Parsec.String| parsePair = do | |
Prelude Text.Parsec Text.Parsec.String| a <- manyTill anyChar $ string "--" | |
Prelude Text.Parsec Text.Parsec.String| b <- many1 alphaNum | |
Prelude Text.Parsec Text.Parsec.String| pure (a, b) | |
Prelude Text.Parsec Text.Parsec.String| :} | |
Prelude Text.Parsec Text.Parsec.String> parse parsePair "" "fo o--bar" | |
Right ("fo o","bar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment