Add the "optionMaybe" combinator to Parsec
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries (other) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |