Strong version of 'local' for reader monad

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Strong version of 'local' for reader monad

Brent Yorgey-2
Hi all,

Today I wanted this function

  strongLocal :: (MonadReader r1 m1, MonadReader r2 m2) =>
                 (r2 -> r1) -> m1 a -> m2 a

Of course, after staring at this type for ten seconds I realized that
it cannot be implemented.  But I wondered whether anyone has any
pointers to anything related, or if anyone has good ideas for a
reasonable interface that would allow this.

-Brent

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Strong version of 'local' for reader monad

Tom Schrijvers-2


On Mon, Dec 13, 2010 at 9:30 PM, Brent Yorgey <[hidden email]> wrote:
Hi all,

Today I wanted this function

 strongLocal :: (MonadReader r1 m1, MonadReader r2 m2) =>
                (r2 -> r1) -> m1 a -> m2 a

Of course, after staring at this type for ten seconds I realized that
it cannot be implemented.  But I wondered whether anyone has any
pointers to anything related, or if anyone has good ideas for a
reasonable interface that would allow this.

Here's a draft by Bruno Oliveira and me on manipulating the monad stack.
The examples in Section 4.3 on p.12-13 are related:

http://users.ugent.be/~tschrijv/Research/papers/virtual_monad_stack.pdf

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe