You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically an implementation like the following leaks space:
source::Monadm=> [Int] ->ConduitTiIntm()
source s =case s of[]->pure()
n : ns -> yield n *> source ns
Switching to >> avoids the problem. That makes me believe that the implementation of *>could/should be optimized.
To be honest I don't fully understand what causes the different behavior (my assumption is that the applicative implementation isn't aware of the container and so the monad implementation takes shortcuts).
A (maybe dirty) hack to solve this problem is to just implement *> with >> by adding
Please let me know if I was unclear or if I could provide further information. Also I'm willing to provide a PR (but need some guidance if a more sophisticated solution is required).
The text was updated successfully, but these errors were encountered:
That description makes sense, and it's the kind of thing that pops up occasionally, especially due to the (now ancient) AMP (Application/Monad Proposal). Your proposed "dirty" hack is actually a perfect approach. Would you be up for opening a PR to make the change?
alaendle
added a commit
to alaendle/conduit
that referenced
this issue
Oct 6, 2022
Basically an implementation like the following leaks space:
Switching to
>>
avoids the problem. That makes me believe that the implementation of*>
could/should be optimized.To be honest I don't fully understand what causes the different behavior (my assumption is that the applicative implementation isn't aware of the container and so the monad implementation takes shortcuts).
A (maybe dirty) hack to solve this problem is to just implement
*>
with>>
by addingto
conduit/conduit/src/Data/Conduit/Internal/Conduit.hs
Lines 146 to 150 in 8020ac8
(See https://stackoverflow.com/questions/73460640/haskell-based-file-streaming-causes-memory-leak for the original problem)
Please let me know if I was unclear or if I could provide further information. Also I'm willing to provide a PR (but need some guidance if a more sophisticated solution is required).
The text was updated successfully, but these errors were encountered: