Add the "optionMaybe" combinator to Parsec
|Reported by:||Maxime Henrion <mux@…>||Owned by:|
|Type of failure:||Test Case:|
|Related Tickets:||Differential Rev(s):|
This patch adds a new combinator named 'optionMaybe' that is just a specialized version of the existing 'option' combinator: it wraps the result into a Maybe type with the expected semantics. That is, intuitively, if the parser fails, 'Nothing' is returned, and if the parser succeeds, 'Just a' is returned (with 'a' being the type of the parser).
It seems generally useful, and has received positive feedback from the haskell-cafe mailing list and on the #haskell IRC channel, where several people have already written something similar a few times.