Adding an ignore function to Control.Monad
dave at zednenem.com
Thu Jun 11 13:48:16 EDT 2009
On Thu, Jun 11, 2009 at 9:37 AM, Sittampalam,
Ganesh<ganesh.sittampalam at credit-suisse.com> wrote:
> 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
>> 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.
How is that a problem? The whole *point* of (>>) is that it discards
unneeded return values.
Dave Menendez <dave at zednenem.com>
More information about the Libraries