A functor satisfies the functor laws.
The Functor
class contains the operations of a functor, but does not require that instances
prove they satisfy the laws of a functor. A LawfulFunctor
instance includes proofs that the laws
are satisfied. Because Functor
instances may provide optimized implementations of mapConst
,
LawfulFunctor
instances must also prove that the optimized implementation is equivalent to the
standard implementation.
Instance Constructor
LawfulFunctor.mk.{u, v}
Methods
map_const : ∀ {α β : Type u}, Functor.mapConst = Functor.map ∘ Function.const β
The mapConst
implementation is equivalent to the default implementation.
id_map : ∀ {α : Type u} (x : f α), id <$> x = x
The map
implementation preserves identity.
comp_map : ∀ {α β γ : Type u} (g : α → β) (h : β → γ) (x : f α), (h ∘ g) <$> x = h <$> g <$> x
The map
implementation preserves function composition.