Functor module:Data package:functor-combinators

A HBifunctor is like an HFunctor, but it enhances two different functors instead of just one. Usually, it enhaces them "together" in some sort of combining way. This typeclass provides a uniform instance for "swapping out" or "hoisting" the enhanced functors. We can hoist the first one with hleft, the second one with hright, or both at the same time with hbimap. For example, the f :*: g type gives us "both f and g":
data (f :*: g) a = f a :*: g a
It combines both f and g into a unified structure --- here, it does it by providing both f and g. The single law is:
hbimap id id == id
This ensures that hleft, hright, and hbimap do not affect the structure that t adds on top of the underlying functors.
An HFunctor can be thought of a unary "functor transformer" --- a basic functor combinator. It takes a functor as input and returns a functor as output. It "enhances" a functor with extra structure (sort of like how a monad transformer enhances a Monad with extra structure). As a uniform inteface, we can "swap the underlying functor" (also sometimes called "hoisting"). This is what hmap does: it lets us swap out the f in a t f for a t g. For example, the free monad Free takes a Functor and returns a new Functor. In the process, it provides a monadic structure over f. hmap lets us turn a Free f into a Free g: a monad built over f can be turned into a monad built over g. For the ability to move in and out of the enhanced functor, see Inject and Interpret. This class is similar to MFunctor from Control.Monad.Morph, but instances must work without a Monad constraint. This class is also found in the hschema library with the same name.
This module provides an abstraction for "two-argument functor combinators", HBifunctor, as well as some useful combinators.
Useful newtype to allow us to derive an HFunctor instance from any instance of HBifunctor, using -XDerivingVia. For example, because we have instance HBifunctor Day, we can write:
deriving via (WrappedHBifunctor Day f) instance HFunctor (Day f)
to give us an automatic HFunctor instance and save us some work.
Lift two isomorphisms on each side of a bifunctor to become an isomorphism between the two bifunctor applications. Basically, if f and f' are isomorphic, and g and g' are isomorphic, then t f g is isomorphic to t f' g'.
This module provides abstractions for working with unary functor combinators. Principally, it defines the HFunctor itself, as well as some classes that expose extra functionality that some HFunctors have (Inject and HBind). See Data.HFunctor.Interpret for tools to use HFunctors as functor combinators that can represent interpretable schemas, and Data.HBifunctor for an abstraction over binary functor combinators.
Lift an isomorphism over an HFunctor. Essentailly, if f and g are isomorphic, then so are t f and t g.