Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#1222 closed proposal (fixed)

Add the "optionMaybe" combinator to Parsec

Reported by: Maxime Henrion <mux@…> Owned by:
Priority: normal Milestone: Not GHC
Component: libraries (other) Version: 6.6
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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.

Attachments (1)

optionMaybe.diff (935 bytes) - added by Maxime Henrion <mux@…> 11 years ago.

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by Maxime Henrion <mux@…>

Attachment: optionMaybe.diff added

comment:1 Changed 11 years ago by igloo

Milestone: Not GHC

comment:2 Changed 10 years ago by mux

Here is a link to my post on libraries@ :

There have been no answers there, but as I say in the ticket, there have been favorable answers from haskell-cafe@ though.

comment:3 Changed 10 years ago by igloo

Resolution: fixed
Status: newclosed

Patch applied, thanks!

comment:4 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:5 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:6 Changed 8 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.