
At Fri, 28 Aug 2009 01:01:09 +0100,
I don't entirely follow what the OP's up to, so you may have a point, but it's far from clear. You're talking about the reader monad, whereas he's talking about the effects in the ReaderT-transformed monad.
oops. Apparently I forgot to explictly state the issue :) I am using ReaderT to lookup symbols in an environment. I am using the inner monad/applicative functor to record whether the lookup failed or succeeded. So I essential have the type:
ReaderT [(a,b)] (Either [a]) b
[(a,b)] is the environment. In the end I get back a value: Either [a] b where [a] is all the symbols that weren't found or 'b' is the final value. For example, if I have: looker :: ReaderT [(String, Int)] (Either [String]) (Int, Int, Int) looker = ((,,) <$> look "foo" <*> look "bar" <*> look "baz") and none of the symbols are in the enviroment then I should get: Left ["foo", "bar", "baz"] The issue is that if I use the free (?) applicative functor instance for ReaderT then I only get back the *first* failure: Left ["foo"] But, if I used my alternative definition, then I get back all the failures. My concern is that my alternative version was somehow violating an applicative functor law. My secondary concern was the free version was somehow violating a law. It seems though, that both are valid... - jeremy