
19 Jan
2009
19 Jan
'09
4:03 p.m.
Is there a reason why the lift function in ReaderT's MonadTrans instance is implemented as: instance MonadTrans (ReaderT r) where lift m = ReaderT $ \_ -> m Instead of just using the monad's return function? Could "lift m" be implemented as "return m"? instance (Monad m) => Monad (ReaderT r m) where * return a = ReaderT $ \_ -> return a* m >>= k = ReaderT $ \r -> do a <- runReaderT m r runReaderT (k a) r fail msg = ReaderT $ \_ -> fail msg Thanks, Daryoush