Mario Román

Home

❯

notes

❯

Continuation passing is cocartesian coclosed

Continuation-passing is cocartesian coclosed

Aug 27, 20251 min read

-- e.g. type R = Double
type Cont x = (x -> R) -> R
type Minus y x = (y, x -> R)
 
cocurry :: (x -> Cont (Either y z)) -> Minus x z -> Cont y 
cocurry f (x, w) q = f x (\case
  Left y -> q y
  Right z -> w z)
  
councurry :: (Minus x z -> Cont y) -> (x -> Cont (Either y z))
councurry f x v = f (x, \z -> v (Right z)) (\y -> v (Left y)) 

References.

  • The Duality of λ-Abstraction (Choudhury, Gay, 2025)

Tags: continuation monad, continuation-passing.


Graph View

Backlinks

  • Continuation monad

Mario Román, CC-BY-SA. Built with Quartz © 2025.

  • GitHub
  • ArXiv
  • OrcID