
Hello, Lately I'm working with Reader monad. Because of that, I have to use function of signature: Monad m => (a -> m b) -> m (a -> b). Is this even possible to do so? Thanks in advance for your help. Best Regards, Szymon Pajzert

Colleague has helped me with the solution for the Reader, without general
solution (probably it's not possible to do so for every monad):
foo :: (a -> Reader r b) -> Reader r (a -> b)
foo f = do
r <- ask
return $ \a -> runReader (f a) r
Hope that's gonna help someone in the future.
On 6 May 2017 at 11:08, Szymon Pajzert
Hello,
Lately I'm working with Reader monad. Because of that, I have to use function of signature:
Monad m => (a -> m b) -> m (a -> b).
Is this even possible to do so? Thanks in advance for your help.
Best Regards, Szymon Pajzert
participants (1)
-
Szymon Pajzert