Monad morphisms and weakest precondition interpretations #
A WP m ps
is a WPMonad m ps
if the interpretation WP.wp
is also a monad morphism, that is,
it preserves pure
and bind
.
class
Std.Do.WPMonad
(m : Type → Type u)
(ps : outParam PostShape)
[Monad m]
extends LawfulMonad m, Std.Do.WP m ps :
Type (max 1 u)
A WP
that is also a monad morphism, preserving pure
and bind
. (They all are.)
- seq_assoc {α β γ : Type} (x : m α) (g : m (α → β)) (h : m (β → γ)) : h <*> (g <*> x) = Function.comp <$> h <*> g <*> x
Instances
instance
Std.Do.EStateM.instWPMonad
{ε σ : Type}
:
WPMonad (EStateM ε σ) (PostShape.except ε (PostShape.arg σ PostShape.pure))
Equations
instance
Std.Do.Except.instWPMonad
{ε : Type}
:
WPMonad (Except ε) (PostShape.except ε PostShape.pure)