oneOf ts succeeds if the current token is in the
supplied collection of tokens
ts. Returns the parsed token.
Note that this parser cannot automatically generate the “expected”
component of error message, so usually you should label it manually
with
label or (
<?>).
oneOf cs = satisfy (`elem` cs)
See also:
satisfy.
digit = oneOf ['0'..'9'] <?> "digit"
Performance note: prefer
satisfy when you can because
it's faster when you have only a couple of tokens to compare to:
quoteFast = satisfy (\x -> x == '\'' || x == '\"')
quoteSlow = oneOf "'\""