[Haskell-cafe] How do I lift Control.Monad.Reader.local?
Nickolay Kudasov
nickolay.kudasov at gmail.com
Thu Oct 31 18:59:14 UTC 2013
Hi David,
I believe the easiest way to do what you want is to use MonadReader class
instead of explicit t (Reader [String] a):
push' :: MonadReader [String] m => String -> m a -> m apush' s = local (s:)
Best,
Nick
2013/10/31 David Fox <dsf at seereason.com>
> I can write a stack push function in the reader monad like so:
>
> import Control.Monad.Reader
>
> push :: String -> Reader [String] a -> Reader [String] a
> push s action = local (s :) action
>
> How can I write a push that works inside a monad transformer?
>
> push' :: MonadTrans t => String -> t (Reader [String]) a -> t (Reader
> [String]) a
> push' s action = ???
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131031/b38a1a2e/attachment.html>
More information about the Haskell-Cafe
mailing list