lambda icon indicating copy to clipboard operation
lambda copied to clipboard

ApplicativeRec

Open jnape opened this issue 6 years ago • 0 comments

It seems like there could exist an equivalent stack-safe applicative, similar to MonadRec, working title ApplicativeRec, with a trampolineA :: ApplicativeRec f => f (a -> RR a b) -> f a -> f b. Furthermore, it would get an instance for free for every MonadRec in the form of trampolineA f = trampolineM (\a -> fmap ($ a) f).

However, applicatives that support custom zip semantics (like IO that can zip in parallel), or applicatives that are implicitly stack-safe but do not support parallel execution (like Lazy) could offer better implementations than the default built on trampolineM.

This may also make it possible for SafeT to preserve nested stack-safe parallel composition for zips.

jnape avatar Oct 05 '19 22:10 jnape