special handing of chain calls (withFilter), [ChainCallAsyncShiftSubst]
rssh opened this issue · 3 comments
When we work with withFilter, we need special handling of chain calls:
return value of IterableAsyncShift.withFilter should be value, which should
represent F[WithFilter], but provide API to maintain chain-calls of (map, flatMap
withFilter) to preserve evaluation delay accorss monad.
I.e. let p is shifted function, p: (a)=> Future[Boolean], and let f: A=>B
without chainCallShiftSubst it'is impossible to write lazy in-foilter, i.e.
translation of
iterabe.withFilter(p).map(f)
will receive eager F[WithFilter[A,C]] after withFilter call and this WithFilter will
be eager, because we can't eliminate F[-s] during callect without losing of lazy semantics.
Solution - is to allow developer to define ChainCallAsyncShift which will propagate lazy semantics
by providing for each method: O.m:A=>B ChainCallAsyncShift .m:F[O].m A => F[B]
also we don't want implicit search during handing of each chain call, so better allow programmer to specify such types as
return types of shifted functions.
implemented, left to document