Opened 7 years ago

Closed 7 years ago

Last modified 4 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: Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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@…> 7 years ago.

Download all attachments as: .zip

Change History (7)

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

comment:1 Changed 7 years ago by igloo

  • Milestone set to Not GHC

comment:2 Changed 7 years ago by mux

Here is a link to my post on libraries@ :

http://www.haskell.org/pipermail/libraries/2007-March/007056.html

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 7 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

Patch applied, thanks!

comment:4 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:5 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:6 Changed 4 years ago by simonmar

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