mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 16:36:13 +03:00
12 lines
322 B
Plaintext
12 lines
322 B
Plaintext
Parser.text
|
|
: ∀(text: String)
|
|
(Parser Unit)
|
|
= λtext
|
|
(Parser.skip Unit
|
|
(Parser.bind Bool Unit (Parser.test text) λsuccess
|
|
(Bool.if success (Parser Unit)
|
|
// then
|
|
(Parser.bind String Unit (Parser.take (String.length text)) λx
|
|
(Parser.pure Unit Unit.one))
|
|
// else
|
|
(Parser.fail Unit "error")))) |