Adding an ignore function to Control.Monad

Sittampalam, Ganesh ganesh.sittampalam at credit-suisse.com
Thu Jun 11 13:53:50 EDT 2009


David Menendez wrote:
> On Thu, Jun 11, 2009 at 9:37 AM, Sittampalam,
> Ganesh<ganesh.sittampalam at credit-suisse.com> wrote: 

>> 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.
> 
> How is that a problem? The whole *point* of (>>) is that it discards
> unneeded return values. 

I think we should avoid having syntax that implicitly does this. So

do getLine
   return 3

should be banned, and users should be forced to write something like

do getLine >> ignore
   return 3

or

do _ <- getLine
   return 3

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