Slots of the exception postconditions #
EPostSlot EPosts ε EPred locates the slot for exceptions of type ε inside exception
postconditions of type EPosts, and EPostSlot.set fills that slot. The throws clause of a
def contract builds its exception postconditions with it: for
ExceptT ε₁ (ExceptT ε₂ (StateM σ)) and a clause on ε₂, the term EPostSlot.set R ⊥
simplifies to (⊥, R, estack⟨⟩).
Instance search dispatches on the exception type in the manner of MonadExceptOf: an
unconstrained ε lands in the outermost slot.
Locates the slot for exceptions of type ε inside exception postconditions of type
EPosts. The slot holds assertions of type ε → EPred.
- set (R : ε → EPred) (eposts : EPosts) : EPosts
Fills the
εslot ofepostswithR. Example:set R (R₁, R₂) = (R₁, R)forεin the second slot.
Instances
A bare exception postcondition such as Except ε's ε → Prop is its own slot.
Equations
- Std.WP.instEPostSlotFun = { set := fun (R x : ε → EPred) => R }
The slot at the head of an exception postcondition stack.
A slot in the tail of an exception postcondition stack. The head instance is tried first,
so an unconstrained ε lands in the outermost slot.