
10 Jul
2009
10 Jul
'09
5:45 a.m.
On Fri, Jul 10, 2009 at 10:35 AM, Wolfgang
Jeltsch
... 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