[Haskell-cafe] Re: what is inverse of mzero and return?

ajb at spamcop.net ajb at spamcop.net
Tue Jan 25 00:23:39 EST 2005


G'day all.

Quoting Daniel Fischer <daniel.is.fischer at web.de>:

> The sad truth is that IO actions in general aren't well defined entities
> (unless we index them with the space-time-coordinates of their invocation).

Not really.  One of the ways that IO used to be implemented (still might
be on some Haskell systems) was as a term language which was effectively
interpreted by the run-time system.  You could, in principle, define Eq
on such a term language, assuming that there weren't any non-Eq values
in subterms.  So the question is relevant.

> If you cannot agree, I have another question: is
>
> return 4 >> return 5 == return 5
>
> true in the IO-Monad?

It sure is:

     return 4 >> return 5
  == return 4 >>= \x -> return 5         (defn of >>)
  == (\x -> return 5) 4                  (return-bind law)
  == return 5

Now what was the question again?

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list