Adding an ignore function to Control.Monad

Sittampalam, Ganesh ganesh.sittampalam at credit-suisse.com
Thu Jun 11 09:37:46 EDT 2009


John Lato wrote:
>> From: Henning Thielemann <lemming at henning-thielemann.de>
>> 

>> No, I think it is already bad enough, that (>>) has type (m a -> m b
>> -> m b) instead of (m () -> m b -> m b). It is like automatically
>> ignoring return values in C. It is too easy to ignore a result that
>> is important. 
> 
> I agree with Henning on forkIO and the like, but I think the current
> type of (>>) is right.  The name of the function is "anonymous bind"
> (at least that's what I learned), and its whole purpose of existence
> is to ignore the value of the first computation while maintaining the
> context.   
> 
> It would be nice if there were greater differentiation between (>>)
> and (>>=), though.  Ideally, (>>) would be changed to something
> longer than (>>=) to prevent accidental mis-typing (i.e. on the
> keyboard). Not that I expect much support for this proposal!  

The main issue (IMO) is that do notation uses (>>) in the desugaring,
which in turn means that it supports statements that just throw away not
() results.

Ganesh

=============================================================================== 
 Please access the attached hyperlink for an important electronic communications disclaimer: 
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 =============================================================================== 
 


More information about the Libraries mailing list