File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,11 @@ import Data.String
77import Control.Monad.State.Class
88import Control.Monad.Error.Class
99
10+ import Data.Foldable
11+ import Data.Monoid
12+
1013import Text.Parsing.Parser
14+ import Text.Parsing.Parser.Combinators
1115
1216eof :: forall m . (Monad m ) => ParserT String m {}
1317eof = do
@@ -36,3 +40,14 @@ char = do
3640 put (substring 1 (lengthS s) s)
3741 return (substr 0 1 s)
3842
43+ satisfy :: forall m . (Monad m ) => (String -> Boolean ) -> ParserT String m String
44+ satisfy f = do
45+ p <- char
46+ r <- if not $ f p then fail " Character did not satisfy prediate" else return p
47+ return r
48+
49+ whiteSpace :: forall m . (Monad m ) => ParserT String m String
50+ whiteSpace = do
51+ list <- many $ string " \n " <|> string " \r " <|> string " " <|> string " \t "
52+ return $ foldMap id list
53+
You can’t perform that action at this time.
0 commit comments