File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 18
18
" package.json"
19
19
],
20
20
"dependencies" : {
21
- "purescript-transformers" : " ~0.1.0 " ,
22
- "purescript-either" : " * " ,
23
- "purescript-maybe" : " ~0.2.0 " ,
24
- "purescript-arrays" : " ~0.2.0 " ,
25
- "purescript-strings" : " * " ,
26
- "purescript-foldable-traversable" : " * "
21
+ "purescript-transformers" : " ~0.2.1 " ,
22
+ "purescript-either" : " ~0.1.3 " ,
23
+ "purescript-maybe" : " ~0.2.1 " ,
24
+ "purescript-arrays" : " ~0.2.1 " ,
25
+ "purescript-strings" : " ~0.3.0 " ,
26
+ "purescript-foldable-traversable" : " ~0.1.3 "
27
27
}
28
28
}
Original file line number Diff line number Diff line change 10
10
type Parser s a = ParserT s Identity a
11
11
12
12
newtype ParserT s m a where
13
- ParserT :: s -> m { consumed :: Boolean, result :: Either ParseError a, input :: s } -> ParserT s m a
13
+ ParserT :: ( s -> m { consumed :: Boolean, result :: Either ParseError a, input :: s }) -> ParserT s m a
14
14
15
15
16
16
### Type Class Instances
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import Data.String
4
4
import Data.Either
5
5
import Data.Foldable
6
6
import Data.Monoid
7
+ import Data.Maybe
8
+ import Data.Char
7
9
8
10
import Control.Alt
9
11
import Control.Alternative
@@ -28,9 +30,9 @@ string s = ParserT $ \s' ->
28
30
29
31
char :: forall m . (Monad m ) => ParserT String m String
30
32
char = ParserT $ \s' ->
31
- return $ case s' of
32
- " " -> { consumed: false , input: s', result: Left (strMsg " Unexpected EOF" ) }
33
- _ -> { consumed: true , input: drop 1 s', result: Right (charAt 0 s' ) }
33
+ return $ case charAt 0 s' of
34
+ Nothing -> { consumed: false , input: s', result: Left (strMsg " Unexpected EOF" ) }
35
+ Just c -> { consumed: true , input: drop 1 s', result: Right (charString c ) }
34
36
35
37
satisfy :: forall m . (Monad m ) => (String -> Boolean ) -> ParserT String m String
36
38
satisfy f = try do
You can’t perform that action at this time.
0 commit comments