(unbundled) morphisms of monads #
This file defines predicates on functions f : ∀ {α}, m α → n α that preserve functor, applicative,
monadic, and alternative structure (IsFunctorHom, IsApplicativeHom, IsMonadHom,
IsAlternativeHom, IsAlternativeMonadHom).
Rather than assuming lawfulness, they explicitly require compatibility with every operator defined by the corresponding typeclasses, with helper constructors that dismiss the derived operators when the structures are lawful.
Functor Homomorphisms #
A function f is a morphism of functors if it preserves <$> and Functor.mapConst.
- map_mapConst {α β : Type u_1} (a : α) (x : m β) : f (Functor.mapConst a x) = Functor.mapConst a (f x)
Instances For
Construct an IsFunctorHom for lawful functors from map_map.
Applicative Homomorphisms #
A function f is a morphism of applicatives if it preserves pure, <$>, <*>, <*, and *>.
- map_mapConst {α β : Type u_1} (a : α) (x : m β) : f (Functor.mapConst a x) = Functor.mapConst a (f x)
Instances For
Construct an IsApplicativeHom for lawful applicatives from map_pure and map_seq.
Monad Homomorphisms #
A function f is a morphism of monads if it preserves pure, >>=, <$>, <*>, <*, and *>.
- map_mapConst {α β : Type u_1} (a : α) (x : m β) : f (Functor.mapConst a x) = Functor.mapConst a (f x)
Instances For
Construct an IsMonadHom for lawful monads from map_pure and map_bind.
Alternative Homomorphisms #
A function f is a morphism of alternatives if it preserves pure, <$>, <*>, <*, *>,
failure, and orElse.
- map_mapConst {α β : Type u_1} (a : α) (x : m β) : f (Functor.mapConst a x) = Functor.mapConst a (f x)
Instances For
Construct an IsAlternativeHom for lawful applicatives from map_pure, map_seq,
map_failure, and map_orElse.
Alternative Monad Homomorphisms #
A function f is a morphism of alternative monads if it preserves monadic and alternative
structure.
- map_mapConst {α β : Type u_1} (a : α) (x : m β) : f (Functor.mapConst a x) = Functor.mapConst a (f x)
Instances For
Construct an IsAlternativeMonadHom for lawful monads from map_pure, map_bind,
map_failure, and map_orElse.