I was reading Oleg's Extensible Effects: An Alternative to Monad Transformers.
The coroutine for arbitrary effects Eff r is the same as Codensity (Free r).
data VE w r = Val w | E (r (VE w r))
newtype Eff r a = Eff{runEff :: ∀ w. (a → VE w r) → VE w r}
So I wondered if the send function had some usefulness in the library, admin is already a specialization of lowerCodensity
send :: (∀ w. (a → VE w r) → r (VE w r)) → Eff r a
send f = Eff $ \k → E (f k)
admin :: Eff r w → VE w r
admin (Eff m) = m Val
but send, producing a Codensity (Free f) a, is not in the library:
send :: (forall x. (a -> Free f x) -> f (Free f x)) -> Codensity (Free f) a
send eff = Codensity \next -> Free (eff next)
I was reading Oleg's Extensible Effects: An Alternative to Monad Transformers.
The coroutine for arbitrary effects
Eff ris the same asCodensity (Free r).So I wondered if the
sendfunction had some usefulness in the library,adminis already a specialization oflowerCodensitybut
send, producing aCodensity (Free f) a, is not in the library: