Opened 10 years ago

Closed 10 years ago

Last modified 7 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: 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@…> 10 years ago.

Download all attachments as: .zip

Change History (7)

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

comment:1 Changed 10 years ago by igloo

  • Milestone set to 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 set to fixed
  • Status changed from new to closed

Patch applied, thanks!

comment:4 Changed 8 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:5 Changed 8 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:6 Changed 7 years ago by simonmar

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