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?