You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,8 @@ A monadic parser combinator library based on Haskell’s
13
13
14
14
Install `parsing` with [Spago](https://github.com/purescript/spago):
15
15
16
-
```sh
17
-
spago install parsing
16
+
```console
17
+
$ spago install parsing
18
18
```
19
19
20
20
## Quick start
@@ -23,7 +23,7 @@ Here is a basic tutorial introduction to monadic parsing with this package.
23
23
24
24
### Parsers
25
25
26
-
A parser turns a string into a data structure. Parsers in this library have the type `Parser s a`, where `s` is the type of the input string, and `a` is the type of the data which the parser will produce on success. `Parser s` is a monad. It’s defined in the module `Text.Parsing.Parser`.
26
+
A parser turns a string into a data structure. Parsers in this library have the type `Parser s a`, where `s` is the type of the input string, and `a` is the type of the data which the parser will produce on success. `Parser s` is a monad. It’s defined in the module `Parsing`.
27
27
28
28
Monads can be used to provide context for a computation, and that’s how we use them in monadic parsing.
29
29
The context provided by the `Parser s` monad is __the parser’s current location in the input string__.
@@ -42,14 +42,14 @@ function, which calls the `throwError` function of the `MonadThrow` typeclass in
42
42
the `Parser s` monad.
43
43
44
44
To run a parser, call the function `runParser :: s -> Parser s a -> Either ParseError a` in
45
-
the `Text.Parsing.Parser` module, and supply it with an input string and a parser.
45
+
the `Parsing` module, and supply it with an input string and a parser.
46
46
If the parse succeeds then the result is `Right a` and if the parse fails then the
47
47
result is `Left ParseError`.
48
48
49
49
### Primitive parsers
50
50
51
51
Each type of input string needs primitive parsers.
52
-
Primitive parsers for input string type `String` are in the `Text.Parsing.Parser.String` module.
52
+
Primitive parsers for input string type `String` are in the `Parsing.String` module.
53
53
For example, the primitive `char :: Char -> Parser String Char` parser will exactly match
54
54
one literal character and then advance by one position in the input string.
55
55
@@ -83,11 +83,11 @@ and then the parser will succeed and return `Right true`.
83
83
84
84
### More parsers
85
85
86
-
There are other `String` parsers in the module `Text.Parsing.Parser.String.Basic`, for example the parser `letter :: Parser String Char` which will accept any single alphabetic letter.
86
+
There are other `String` parsers in the module `Parsing.String.Basic`, for example the parser `letter :: Parser String Char` which will accept any single alphabetic letter.
87
87
88
88
### Parser combinators
89
89
90
-
Parser combinators are in this package in the module `Text.Parsing.Parser.Combinators`.
90
+
Parser combinators are in this package in the module `Parsing.Combinators`.
91
91
92
92
A parser combinator is a function which takes a parser as an argument and returns a new parser. The `many` combinator, for example, will repeat a parser as many times as it can. So the parser `many letter` will have type `Parser String (Array Char)`.
0 commit comments