stack-safe IO#988
Conversation
|
👍 Great to see this! BTW using trivial implementation of traversable instance for array with other lazyish structures like Reader, State etc, will break with overflow when used on large array. it's possible to fix that for all such types like this sanctuary-js/sanctuary-type-classes#19 |
|
Interesting, that seems to be very similar to the implementation in https://github.com/purescript/purescript-foldable-traversable/blob/master/src/Data/Traversable.js array.sequence(S.state)(range(0, N).map(S.state.of))(undefined)Is indeed stack overflowing for me with N greater than 5000 |
|
@giogonzo did you decide to fix Traversable instance instead? |
|
@safareli no, we didn't do nothing (that I'm aware of) in the end. Even if stack-safety-related issues come up from time to time, it doesn't seem to be a high priority for fp-ts at the moment (and there are workarounds, i.e. batching operations) Also, the community is expanding in terms of higher-level libraries, and e.g. https://github.com/Matechs-Garage/matechs-effect 's |
A porting of purescript/purescript-effect#12 by @safareli
related to #907
Pros
IOstack safe (currently I get a "Maximum call stack size exceeded" error with e.g.array.sequence(io)(range(0, 10000).map(io.of))())IO<A>(a thunk() => A)IOCons
IONotes
Task(see e.g. [Task] Maximum call stack size exceeded #983)?Benchmarks
"big"
"small"
Opinions?