File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,10 @@ char = ParserT $ \s' ->
3434 _ -> { consumed: true , input: drop 1 s', result: Right (charAt 0 s') }
3535
3636satisfy :: forall m . (Monad m ) => (String -> Boolean ) -> ParserT String m String
37- satisfy f = ParserT $ \s' -> case s' of
38- " " -> return { consumed: false , input: s', result: Left (strMsg " Unexpected EOF" ) }
39- _ ->
40- let c = charAt 0 s'
41- in return $ if f c
42- then { consumed: true , input: drop 1 s', result: Right c }
43- else { consumed: false , input: s', result: Left (strMsg " Character did not satisfy predicate" ) }
37+ satisfy f = try do
38+ c <- char
39+ if f c then return c
40+ else fail " Character did not satisfied predicate"
4441
4542whiteSpace :: forall m . (Monad m ) => ParserT String m String
4643whiteSpace = do
You can’t perform that action at this time.
0 commit comments