Transferring Traversable instances along isomorphisms #
This file allows to transfer Traversable instances along isomorphisms.
Main declarations #
Equiv.map: Turns functorially a functionα → βinto a functiont' α → t' βusing the functortand the equivalenceΠ α, t α ≃ t' α.Equiv.functor:Equiv.mapas a functor.Equiv.traverse: Turns traversably a functionα → m βinto a functiont' α → m (t' β)using the traversable functortand the equivalenceΠ α, t α ≃ t' α.Equiv.traversable:Equiv.traverseas a traversable functor.Equiv.isLawfulTraversable:Equiv.traverseas a lawful traversable functor.
Given a functor t, a function t' : Type u → Type u, and
equivalences t α ≃ t' α for all α, then every function α → β can
be mapped to a function t' α → t' β functorially (see
Equiv.functor).
Instances For
Like Equiv.map, a function t' : Type u → Type u can be given
the structure of a traversable functor using a traversable functor
t' and equivalences t α ≃ t' α for all α. See Equiv.traversable.
Equations
- Equiv.traverse eqv f x = ⇑(eqv β) <$> traverse f ((eqv α).symm x)
Instances For
The function Equiv.traverse transfers a traversable functor
instance across the equivalences eqv.
Equations
- Equiv.traversable eqv = { toFunctor := Equiv.functor eqv, traverse := fun {m : Type ?u.26 → Type ?u.26} [Applicative m] {α β : Type ?u.26} => Equiv.traverse eqv }
Instances For
The fact that t is a lawful traversable functor carries over the
equivalences to t', with the traversable functor structure given by
Equiv.traversable.
If the Traversable t' instance has the properties that map,
map_const, and traverse are equal to the ones that come from
carrying the traversable functor structure from t over the
equivalences, then the fact that t is a lawful traversable functor
carries over as well.