I applied Haskell's Applicative Functors to Kotlin Coroutines. Here's what happened.
How currying, functors, applicative functors and monads from Haskell led me to build a parallel orchestration library for Kotlin coroutines with zero overhead. tags: kotlin, functionalprogramming, ...

Source: DEV Community
How currying, functors, applicative functors and monads from Haskell led me to build a parallel orchestration library for Kotlin coroutines with zero overhead. tags: kotlin, functionalprogramming, haskell, coroutines If you know Haskell, you already know this library In Haskell, combining independent IO actions looks like this: mkDashboard <amp;gt; fetchUser <*> fetchCart <*> fetchPromos Three independent effects. The runtime can execute them however it wants — including in parallel. The structure tells you: these don't depend on each other. When one result depends on another, you switch to monadic bind: do ctx <- mkContext <amp;gt; fetchProfile <*> fetchPrefs <*> fetchTier mkDashboard <amp;gt; fetchRecs ctx <*> fetchPromos ctx <*> fetchTrending ctx Phase 1 is applicative (parallel). Phase 2 is monadic (depends on ctx). The code shape is the dependency graph. I looked at Kotlin coroutines and saw the same problem: you need to orchestrate parall