Functors #
This module provides additional lemmas, definitions, and instances for Functors.
Main definitions #
Functor.Const αis the functor that sends all types toα.Functor.AddConst αisFunctor.Const αbut for whenαhas an additive structure.Functor.Comp F Gfor functorsFandGis the functor composition ofFandG.LiftpandLiftrrespectively lift predicates and relations on a typeαtoF α. Terms ofF αare considered to, in some sense, contain values of typeα.
Tags #
functor, applicative
Const α is the constant functor, mapping every type to α. When
α has a monoid structure, Const α has an Applicative instance.
(If α has an additive monoid structure, see Functor.AddConst.)
Equations
Instances For
AddConst α is a synonym for constant functor Const α, mapping
every type to α. When α has an additive monoid structure,
AddConst α has an Applicative instance. (If α has a
multiplicative monoid structure, see Functor.Const.)
Equations
Instances For
AddConst.mk is the canonical map α → AddConst α β, which is the identity,
where AddConst α β = Const α β. It can be used as a pattern to extract this value.
Equations
Instances For
Extract the element of α from the constant functor.
Equations
Instances For
The <*> operation for the composition of applicative functors.
Equations
Instances For
Equations
Equations
Equations
If we consider x : F α to, in some sense, contain values of type α, then
Liftr r x y relates x and y iff (1) x and y have the same shape and
(2) we can pair values a from x and b from y so that r a b holds.
Equations
Instances For
If f is a functor, if fb : f β and a : α, then mapConstRev fb a is the result of
applying f.map to the constant function β → α sending everything to a, and then
evaluating at fb. In other words it's const a <$> fb.
Equations
Instances For
If f is a functor, if fb : f β and a : α, then mapConstRev fb a is the result of
applying f.map to the constant function β → α sending everything to a, and then
evaluating at fb. In other words it's const a <$> fb.