Closed ivan-m closed 7 years ago
It appears that hoist
doesn't like running any monad transformer: I tried converting Stream (Of a) (StateT s m) r
to Stream (Of a) m r
with hoist (flip evalStateT initS)
and it was run individually on each monadic step (so the state did not accumulate).
The same applies to conduit, so this may be a fundamental limitation of hoist
.
I'll see if I can adapt how conduit does it to Stream
s.
(Probably other functions as well, but this is where I found it.)
Let us take a completely ridiculous example as a motivator, running this all in ghci.
If I get the effects out first and then get chunks, it works as expected:
(and indeed,
1 + 3 + 5 == 9
,7 + 9 == 16
).However, to be able to do the chunks first (because I may be wanting to use the first part of the
Stream
for something):Now the chunking seems to only take one item at a time.
I'm not sure if the fault here is with
chunksOf
orsplitAt
, as I'm still trying to work out how to do the same thing withsplitAt
(as its type doesn't play well withhoist
orembed
).