on master help sign in
streamly/docs/Developer/overview.md
24 lines 1.1 kB history raw
1# Streamly
3This document is yet to be written. It is supposed to provide an overall
4design overview for developers.
6## Tricky Parts
8The state-passing through each API is currently fragile. Every time we run a
9stream we need to be careful about the state we are passing to it. In case of
10folds where there is no incoming state, we start with the initial state
11`defState`. When we have an incoming state passed to us there are two cases:
131. When we are building a concurrent stream that needs to share the same `SVar`
14 we pass the incoming state as is.
152. In all other cases we must not share the SVar and every time we pass on the
16 state to run a stream we must use `adaptState` to reset the `SVar` in the
17 state.
19When in doubt just use `adaptState` on the state before passing it on, we will at
20most lose concurrency but the behavior will be correct.
22There is no type level enforcement about this as of now, and therefore we need
23to be careful when coding. There are specific tests to detect and report any
24problems due to this, all transform operations must be added to those tests.