PaperRead it asCode intuition
Γthe context typethe type of the whole mediated world
γ, δparticular context statestwo snapshots of that world
f : Γ → Γa state transformation(world) => changedWorld
g ∘ fcompositionrun f, then g
idΓidentitya no-op transformation
A × Bproduct type[A, B] or { a, b }
A ⇀ Bpartial functionmay throw or return undefined
Maybe(A)optional valueA | undefined
Either(E, A)error or valueResult<A, E>
μX. F(X)recursive typean interface containing its own shape
σ ⊧ dcontext satisfies needsevery required key is present
≃observational equivalenceno allowed operation can tell apart
1Category basics
Objects, arrows, composition
For this paper, think of types as objects and functions as arrows. Arrows compose when outputs and inputs match. Associativity lets us ignore parentheses; identity arrows do nothing.
Γ — f → Γ — g → Γ
g ∘ f means f first, then g
2The monoid actually used
Endomorphisms form an algebra
All arrows from Γ back to Γ are closed under composition, composition is associative, and idΓ is the unit. That is a monoid—the algebra behind sequencing effects and their inverses.
(Γ → Γ, ∘, idΓ)
3Monads and effects
A context for sequencing extra behavior
A monad wraps values with computational structure: Maybe<A> for failure, State<S,A> for state, IO<A> for interaction. The paper reviews this lineage, then reifies effects as runtime state transformations instead of adding static annotations.
A → T(A) then flatten T(T(A)) → T(A)
4Comonads and coeffects
The dual question: what surrounds the value?
If effects describe what computation produces, coeffects describe context it consumes. The Environment comonad pairs a value with environment E × A; Cordis turns that idea into a live service table and dependency specification.
D(A) → A extract
D(A) → D(D(A)) duplicate context
5Type families
The key determines the value type
V : K → Type means each dependency key maps to its own type: database maps to Database, clock to Clock. A dependent partial map keeps those associations type-correct.
Σ = (k : K) ⇀ V(k)
6Witnesses and refinements
A value paired with its proof obligation
A witnessed effect is not just code returning an inverse; its type carries the condition that the inverse recovers the state where it was created. The implementation trusts authors to meet that condition.
e(γ) = (δ, g) with g(δ) ≃ γ
Useful correctionA returned g is a one-sided, state-local inverse. The paper requires g(f(γ)) ≃ γ where the effect ran—not necessarily f(g(γ)) = γ, and not necessarily a globally invertible computation.