option package:parsec-class
option x p tries to apply parser
p. If
p
fails without consuming input, it returns the value
x,
otherwise the value returned by
p.
priority = option 0 (do{ d <- digit
; return (digitToInt d)
})
optionMaybe p tries to apply parser
p. If
p
fails without consuming input, it return
Nothing, otherwise it
returns
Just the value returned by
p.
optional p tries to apply parser p. It will parse
p or nothing. It only fails if p fails after
consuming input. It discards the result of p.