Module
Data.Functor.Hoist
- Package
- purescript-hoist
- Repository
- paf31/purescript-hoist
#Hoist Source
type Hoist s t a b = a ~> b -> s ~> t
Hoist
asserts that natural transformations between a
and b
can
be hoisted to natural transformations between s
and t
.
Usefully, the types line up with several standard functions from the core libraries:
Control.Monad.Free.hoistFree :: forall f g. Hoist (Free f) (Free g) f g
Data.Coyoneda.hoistCoyoneda :: forall f g. Hoist (Coyoneda f) (Coyoneda g) f g
Data.Yoneda.hoistYoneda :: forall f g. Hoist (Yoneda f) (Yoneda g) f g
And from purescript-mmorph
:
hoist :: forall f g t. MFunctor t => Hoist (t f) (t g) f g
These functions compose like lenses, allowing us to hoist natural transformations over small parts of a structure:
hoistFree ⇜ right ⇜ first
:: forall f g x y
. Hoist (Free (Coproduct x (Product f y))) (Free (Coproduct x (Product g y))) f g
#composeHoist Source
composeHoist :: forall f e d c b a. Hoist e f c d -> Hoist c d a b -> Hoist e f a b
Compose Hoist
ing functions.
This is provided to help with type inference.
- Modules
- Data.
Functor. Hoist