@@ -209,21 +209,19 @@ export
209209notLike : Char -> Lexer
210210notLike x = Pred (\y => toUpper x /= toUpper y)
211211
212−||| Recognise a specific string
213−export
212+||| Recognise a specific string.
213+||| Fails if the string is empty.
214214exact : String -> Lexer
215−exact str with (unpack str)
216− exact str | [] = Fail -- Not allowed, Lexer has to consume
217− exact str | (x :: xs)
218− = foldl SeqEmpty (is x) (map is xs)
215+exact str = case map is (unpack str) of
216+ [] => fail
217+ (x :: xs) => concat (x :: xs)
219218
220−||| Recognise a specific string case-insensitively
221−export
219+||| Recognise a specific string (case-insensitive).
220+||| Fails if the string is empty.
222221approx : String -> Lexer
223−approx str with (unpack str)
224− approx str | [] = Fail -- Not allowed, Lexer has to consume
225− approx str | (x :: xs)
226− = foldl SeqEmpty (like x) (map like xs)
222+approx str = case map like (unpack str) of
223+ [] => fail
224+ (x :: xs) => concat (x :: xs)
227225
228226||| Recognise a lexer or recognise no input. This is not guaranteed
229227||| to consume input