[Haskell-cafe] monad subexpressions
jules at jellybean.co.uk
Fri Aug 3 04:38:09 EDT 2007
Jules Bean wrote:
> a <- m
> b <- n
> l a x b y
> l (<- m) x (<- n) y
> ...with, I suppose, left-to-right evaluation order. This looks 'almost
> like substitution' which is the goal.
Having read the thread SPJ pointed to, I should point out that using a
mixture of Applicative and Monad notation, this can currently be written as:
l <$> m <*> (return x) <*> n =<< (return y)
...where the thing that feels weirdest is having to remember to use =<<
instead of <*> for the final 'application'.
More information about the Haskell-Cafe