Adding an ignore function to Control.Monad

Gwern Branwen gwern0 at gmail.com
Mon Dec 14 11:06:13 EST 2009


On Fri, Jul 17, 2009 at 8:43 AM, Wolfgang Jeltsch
<g9ks157k at acme.softbase.org> wrote:
> Am Sonntag, 12. Juli 2009 11:54 schrieb Nicolas Pouillard:
>> Excerpts from Michael Snoyman's message of Sat Jul 11 22:03:49 +0200 2009:
>> > I'm not opposed to using void instead of ignore. Out of curiosity, is
>> > anyone interested in having the Functor version of void? I'm not sure I
>> > see a reason to unnecessarily limit ourselves to Monads here.
>>
>> +1 to a functor version
>
> +1
>
> The function could be used, for example, as a parser, and parsers are not
> always monads.
>
>> What about 'discard'?
>
> Sounds good.
>
> Best wishes,
> Wolfgang

Approximately 5 months later, it seems no one has commented on it
since. Too bad; it could've made it in in time for GHC 6.12.

At this point I'd like to run another poll to see whether consensus
has changed. If no one objects beyond what we've already seen, I'm
going to submit a 'void :: f a -> f ()' patch as the most universal &
general version, and hopefully it will be applied...

You'll remember the last one wound up being:

# Nothing
- David Menendez
- Henning Thielemann (?)
- John Meachem (?)

# Just
## Control.Monad.ignore :: m a -> m ()
- Isaac Dupree
- Martijn van Steenbergen
- Maurí­cio
- Michael Snoyman
- Neil Mitchell

### Control.Monad.ignore::  f a -> f ()
- Edward Kmett

## Control.Monad.void m a -> m ()
(or void :: f a -> f ())

- Don Stewart
- Iavor Diatchki
- Jeff Wheeler
- Johann Tibell
- Malcolm Wallace
- Michael Snoyman (as well)
- Nicolas Pouillard
- Stephan Friedrichs

## Control.Monad.discard :: f a -> f ()
- Nicolas Pouillard
- Wolfgang Jeltsch

-- 
gwern


More information about the Libraries mailing list