[Haskell-cafe] Transforming from on State-transformer to another
ietf-dane at dukhovni.org
Wed Nov 20 20:40:40 UTC 2019
> On Nov 20, 2019, at 1:08 PM, Jacques Carette <carette at mcmaster.ca> wrote:
> In the particular case of interest, I am interested in is actually b -> State a c -> (State (a,b) c), which is of course a special case of the above.
> Use case: a Stateful computation where a local sub-computation needs more (local) state that will be, in-time, de-allocated.
Perhaps I misunderstood your use-case, but it seems that with a local
sub-computation that needs extra state you can just:
st <- get
(c, (st', _)) <- runStateT local (st, extra)
where local :: StateT (a, b) m c.
More information about the Haskell-Cafe