Ticket #3453 (closed proposal: wontfix)

Opened 4 years ago

Last modified 4 years ago

Add "check" function to Control.Monad

Reported by: JonFairbairn Owned by:
Priority: normal Milestone: Not GHC
Component: libraries/base Version: 6.10.4
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Generalisation of "guard".

check (not . isSpace) 'c' == Just 'c'

check (not . isSpace) ' ' == Nothing

See example in attached darcs patch

Attachments

check Download (10.3 KB) - added by JonFairbairn 4 years ago.
darcs patch on base

Change History

Changed 4 years ago by JonFairbairn

darcs patch on base

Changed 4 years ago by JonFairbairn

Timescale: 14 days.

Changed 4 years ago by igloo

  • difficulty set to Unknown
  • milestone set to Not GHC

I think 14 days is unrealistic given the timing relative to ICFP et al, and suggest end of Sept as the deadline.

Changed 4 years ago by JonFairbairn

I suspect the consensus on this is not to add this function, but to add mfilter instead. I'll open a separate ticket for that.

Changed 4 years ago by JonFairbairn

  • status changed from new to closed
  • resolution set to wontfix

I've opened ticket #3524 to add mfilter.

To paraphrase what I said on the libraries mailing list, the consensus is not to add check because it is a small function that readily be written in terms of other well known ones, though this writing will be much easier in the presence of mfilter.

I fear I should have made it clear in the proposal that the point of check is that it's more algebraically handy than guard, but as it's too late to replace guard we would have had to have both.

Note: See TracTickets for help on using tickets.