[Haskell-cafe] Alternative IO

Cristiano Paris frodo at theshire.org
Fri Jul 10 05:45:55 EDT 2009


On Fri, Jul 10, 2009 at 10:35 AM, Wolfgang
Jeltsch<g9ks157k at acme.softbase.org> wrote:
> ...
> Hello Cristiano,
>
> I fear that this instance doesn’t satisfy required laws. As far as I know, the
> following equalities should hold:
>
>    (*>) = (>>)
>
>    f *> empty = empty
>
>    empty <|> g = g
>
> This implies the following:
>
>    (f >> empty) <|> g = g
>
> But this wouldn’t hold with your instance. (f >> empty) <|> g would cause the
> side effects of f and of g, while g would (obviously) only cause the side
> effects of g.
>
> If empty would be a real empty, it would have to undo the effects of previous
> actions (like f above). So an Applicative instance makes sense for STM but
> not for IO.

Thanks. That's an argument :)

-- 
Cristiano


More information about the Haskell-Cafe mailing list