Adding an ignore function to Control.Monad

Iavor Diatchki iavor.diatchki at gmail.com
Thu Jul 2 18:01:30 EDT 2009


Hi,
I am not convinced that we need this function in the standard
libraries but if people find it useful, then I agree with Don's point
that we should stick with "void" because I think that:

void readLine

read better then

ignore readLine

-Iavor
PS: How about devNull = return ()?  Then readLine >> devNull would
make sense! :p



On Thu, Jul 2, 2009 at 10:22 AM, Don Stewart<dons at galois.com> wrote:
> I for one don't like 'ignore' -- it implies to me somehow that the
> argument itself is ignored, rather than the result after evaluation.
>
> Also, 'void' already exists, and is part of a decade-old FFI standard.
>
> -- Don
>
> ekmett:
>> I agree with Neil on all those points. F.M.E.void has too many things to fix to
>> bring it inline with ignore in one go and a worse name.
>>
>> +1 on adding ignore though.
>>
>> -Edward Kmett
>>
>> On Thu, Jul 2, 2009 at 2:26 AM, Neil Mitchell <ndmitchell at gmail.com> wrote:
>>
>>     void is the wrong name, wrong type, wrong purpose and wrong module. We
>>     could fix all those things, but I think we should just add ignore as
>>     previously agreed (+1 for that)
>>
>>     Thanks, Neil
>>
>>     On Thu, Jul 2, 2009 at 4:11 AM, Isaac
>>     Dupree<ml at isaac.cedarswampstudios.org> wrote:
>>     > Gwern Branwen wrote:
>>     >>
>>     >> Since then, Don Stewart has pointed out
>>     >> http://hackage.haskell.org/trac/ghc/ticket/3292 that there is a very
>>     >> similar function specified in the FFI standard
>>     >> http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi/ffise5.html#
>>     x8-350005.10
>>     >> - 'void     :: IO a -> IO ()'.
>>     >
>>     > Are we willing to change (generalize) the type of
>>     > Foreign.Marshal.Error.void?  If so, we could export (void :: Functor m =>
>>     m
>>     > a -> m ()) from both Control.Monad and F.M.E (if we wanted to).  If we're
>>     > not willing, then I think it would be a bit more convenient to name them
>>     > different things (so that if you import both modules you don't get a
>>     > name-conflict for using 'void').
>>     >
>>     > I vote to just name it Control.Monad.ignore .  Many people independently
>>     > invented the name "ignore" in their own projects.  Also I suspect the
>>     name
>>     > "void" in FFI has some etymology in C's equivalent, casting expressions
>>     to
>>     > void (eg: (void)printf(something); ) which I doubt most haskell coders
>>     care
>>     > about most of the time?
>>     >
>>     > -Isaac
>>     > _______________________________________________
>>     > Libraries mailing list
>>     > Libraries at haskell.org
>>     > http://www.haskell.org/mailman/listinfo/libraries
>>     >
>>     _______________________________________________
>>     Libraries mailing list
>>     Libraries at haskell.org
>>     http://www.haskell.org/mailman/listinfo/libraries
>>
>>
>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list