Text.Lexer: export a fail function
Adds the function `fail`.
The expored API of this module currently allows the construction of
an always-failing `Lexer` in various ways. This function makes that
explicit.
The function `fail` has an implicit argument {c} like `Fail`, so it
can return both consuming and non-consuming recognisers.
commitac976923ce9d98ea448fd972e2cac7414f203e1c
authorMichael Morgan <morgan.michael@me.com>
dateThu 31 Aug 2017, 02:36 (9 years ago)
parent4251ad8
libs/contrib/Text/Lexer.idr+5
@@ -39,6 +39,11 @@ export
3939(<|>) : Recognise c1 -> Recognise c2 -> Recognise (c1 && c2)
4040(<|>) = Alt
4141
42+||| A recogniser that always fails.
43+export
44+fail : Recognise c
45+fail = Fail
46+
4247||| Positive lookahead. Never consumes input.
4348export
4449expect : Recognise c -> Recognise False