I need a value of type Parser ()
which would succeed (and return ()
) on empty (lenght 0) input, and fail in all other cases.
pSatisfy (const False)
doesn't quite do what's required. pEnd
doesn't even seem appropriate for this purpose.
pExact 0 pAscii
might be the exact "by-definition" solution. Still doesn't seem to work:
ghci> runParser "<input>" (pSymbol "aaa" <|> pSymbol "bbb" <|> pExact 0 pAscii) ""
*** Exception: ambiguous parser?
It seems that the idea of uu-parsinglib it to be more declarative than e.g. parsec, so you just have
pure ()
:And you need to structure your grammar in the way it doesn't need magical
EOF
symbol.