
Ozgur Akgun
I don't know whether this is related or not, but I have the following somewhere in my code:
-- the following is apparently eqivalent to (\ i -> foo (bar i) i). -- pointfree suggests so. i don't understand why. (foo =<< bar)
Is this a similar situation?
Yes, it is. In the reader monad a computation is a function of one argument: foo :: a -> e -> b bar :: e -> a Running such a computation means passing a specific argument 'e' to all those functions and regarding monadic bindings like normal let bindings. Let me write this in 'do' syntax, so it gets clearer: do x <- bar foo x becomes: let x = bar e in foo x e I found the reader monad most useful in applicative style: splits :: [a] -> [([a], [a])] splits = zip <$> inits <*> tails Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/