[Haskell-cafe] state monad transformer that adds or combines state

Will Yager will.yager at gmail.com
Tue May 15 21:49:12 UTC 2018


Check out http://hackage.haskell.org/package/lens-4.16.1/docs/Control-Lens-Zoom.html#v:zoom

> On May 15, 2018, at 17:39, Ryan Reich <ryan.reich at gmail.com> wrote:
> 
> You can use plain get and put to interact with the outer state, and you have to apply lift to use the inner state. This problem, which for almost any other combination of transformers is solved by mtl's web of MonadState instances, is an example of why the topic of "extensible effects" is so hot. You are basically asking to add, and later subtract, a new state "effect". Barring rewriting your original state type as a product that includes the new one, there isn't really a neat way of doing this.
> 
>> On Tue, May 15, 2018, 14:29 Dennis Raddle <dennis.raddle at gmail.com> wrote:
>> I'm not sure what happens if I apply a StateT to an existing State or StateT monad. Not sure how 'get' and 'put' would function, or if I would need to lift get and put to choose which state to access.
>> 
>> D
>> 
>>> On Tue, May 15, 2018 at 12:49 AM, Francesco Ariis <fa-ml at ariis.it> wrote:
>>> On Mon, May 14, 2018 at 10:27:19PM -0700, Dennis Raddle wrote:
>>> > In local computations, I may want to use some additional state. Is there a
>>> > way to add a little extra state temporarily?
>>> 
>>> Would StateT work (in general, taking advantage of what transformers
>>> have to offer)?
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>> 
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180515/a520ec26/attachment.html>


More information about the Haskell-Cafe mailing list