functor-combinators-0.3.6.0: Tools for functor combinator-based program design

Data.Functor.Combinator

Description

Functor combinators and tools (typeclasses and utiility functions) to manipulate them. This is the main "entrypoint" of the library.

Classes include:

• HFunctor and HBifunctor, used to swap out the functors that the combinators modify
• Interpret, Associative, Tensor, used to inject and interpret functor values with respect to their combinators.

We have some helpful utility functions, as well, built on top of these typeclasses.

The second half of this module exports the various useful functor combinators that can modify functors to add extra functionality, or join two functors together and mix them in different ways. Use them to build your final structure by combining simpler ones in composable ways!

See https://blog.jle.im/entry/functor-combinatorpedia.html and the README for a tutorial and a rundown on each different functor combinator.

Synopsis

# Classes

A lot of type signatures are stated in terms of ~>. ~> represents a "natural transformation" between two functors: a value of type f ~> g is a value of type 'f a -> g a that works for any a@.

type (~>) (f :: k -> Type) (g :: k -> Type) = forall (x :: k). f x -> g x infixr 0 #

A natural transformation from f to g.

type (<~>) f g = forall p a. Profunctor p => p (g a) (g a) -> p (f a) (f a) infixr 0 Source #

The type of an isomorphism between two functors. f <~> g means that f and g are isomorphic to each other.

We can effectively use an f <~> g with:

viewF   :: (f <~> g) -> f a -> g a
reviewF :: (f <~> g) -> g a -> a a


Use viewF to extract the "f to g" function, and reviewF to extract the "g to f" function. Reviewing and viewing the same value (or vice versa) leaves the value unchanged.

One nice thing is that we can compose isomorphisms using . from Prelude:

(.) :: f <~> g
-> g <~> h
-> f <~> h


Another nice thing about this representation is that we have the "identity" isomorphism by using id from Prelude.

id :: f <~> g


As a convention, most isomorphisms have form "X-ing", where the forwards function is "ing". For example, we have:

splittingSF :: Monoidal t => SF t a <~> t f (MF t f)
splitSF     :: Monoidal t => SF t a  ~> t f (MF t f)


## Single Functors

Classes that deal with single-functor combinators, that enhance a single functor.

class HFunctor t where Source #

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.

Methods

hmap :: (f ~> g) -> t f ~> t g Source #

If we can turn an f into a g, then we can turn a t f into a t g.

It must be the case that

hmap id == id


Essentially, t f adds some "extra structure" to f. hmap must swap out the functor, without affecting the added structure.

For example, ListF f a is essentially a list of f as. If we hmap to swap out the f as for g as, then we must ensure that the "added structure" (here, the number of items in the list, and the ordering of those items) remains the same. So, hmap must preserve the number of items in the list, and must maintain the ordering.

The law hmap id == id is a way of formalizing this property.

#### Instances

Instances details
 Source # Instance details Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Dec1 f ~> Dec1 g Source # Source # Instance details Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Dec f ~> Dec g Source # Source # Instance detailsDefined in Data.Functor.Apply.Free Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap1 f ~> Ap1 g Source # HFunctor (Night f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Night f f0 ~> Night f g Source # HFunctor (Reverse :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Reverse f ~> Reverse g Source # HFunctor (Backwards :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Backwards f ~> Backwards g Source # HFunctor (IdentityT :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> IdentityT f ~> IdentityT g Source # HFunctor (Flagged :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Flagged f ~> Flagged g Source # HFunctor (Steps :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Steps f ~> Steps g Source # HFunctor (Step :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Step f ~> Step g Source # HFunctor (MaybeF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> MaybeF f ~> MaybeF g Source # HFunctor (NonEmptyF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> NonEmptyF f ~> NonEmptyF g Source # HFunctor (ListF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> ListF f ~> ListF g Source # HFunctor (Comp f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> Comp f f0 ~> Comp f g Source # HFunctor (Void2 :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Void2 f ~> Void2 g Source # HFunctor (NEMapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> NEMapF k2 f ~> NEMapF k2 g Source # HFunctor (MapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> MapF k2 f ~> MapF k2 g Source # HFunctor (Sum f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> Sum f f0 ~> Sum f g Source # HFunctor (Product f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> Product f f0 ~> Product f g Source # HFunctor ((:+:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> (f :+: f0) ~> (f :+: g) Source # HFunctor ((:*:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> (f :*: f0) ~> (f :*: g) Source # HFunctor (ProxyF :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> ProxyF f ~> ProxyF g Source # HFunctor t => HFunctor (HLift t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> HLift t f ~> HLift t g Source # HFunctor t => HFunctor (HFree t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> HFree t f ~> HFree t g Source # HBifunctor t => HFunctor (Chain1 t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Chain1 t f ~> Chain1 t g Source # HFunctor (Final c :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Final Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Final c f ~> Final c g Source # HFunctor (Joker f :: (k2 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Joker f f0 ~> Joker f g Source # HFunctor (M1 i c :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> M1 i c f ~> M1 i c g Source # Functor f => HFunctor ((:.:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> (f :.: f0) ~> (f :.: g) Source # HBifunctor t => HFunctor (WrappedHBifunctor t f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> WrappedHBifunctor t f f0 ~> WrappedHBifunctor t f g Source # HFunctor (ConstF e :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> ConstF e f ~> ConstF e g Source # HFunctor t => HFunctor (WrapHF t :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> WrapHF t f ~> WrapHF t g Source # HFunctor (LeftF f :: (k2 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> LeftF f f0 ~> LeftF f g Source # HFunctor (RightF g :: (k2 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodshmap :: forall (f :: k -> Type) (g0 :: k -> Type). (f ~> g0) -> RightF g f ~> RightF g g0 Source # HFunctor (Void3 f :: (k2 -> Type) -> k3 -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Void3 f f0 ~> Void3 f g Source # HBifunctor t => HFunctor (Chain t i :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Chain t i f ~> Chain t i g Source # HBifunctor t => HFunctor (WrapHBF t f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Methodshmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> WrapHBF t f f0 ~> WrapHBF t f g Source # HFunctor (NS :: (k -> Type) -> [k] -> Type) Source # Since: 0.3.0.0 Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> NS f ~> NS g Source # HFunctor (NP :: (k -> Type) -> [k] -> Type) Source # Since: 0.3.0.0 Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> NP f ~> NP g Source # HFunctor (CoRec :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> CoRec f ~> CoRec g Source # HFunctor (Rec :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Rec f ~> Rec g Source # HFunctor (Tagged :: (k -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Tagged f ~> Tagged g Source # Source # Note that there is no Interpret or Bind instance, because inject requires Functor f. Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> MaybeT f ~> MaybeT g Source # Source # Note that there is no Interpret or Bind instance, because inject requires Functor f. Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> F f ~> F g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap f ~> Ap g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap f ~> Ap g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap f ~> Ap g Source # Source # Since: 0.3.6.0 Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> AltF f ~> AltF g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Alt f ~> Alt g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Yoneda f ~> Yoneda g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Coyoneda f ~> Coyoneda g Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Coyoneda f ~> Coyoneda g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> WrappedApplicative f ~> WrappedApplicative g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> MaybeApply f ~> MaybeApply g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Lift f ~> Lift g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Free1 f ~> Free1 g Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Free f ~> Free g Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DecAlt f ~> DecAlt g Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DecAlt1 f ~> DecAlt1 g Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DivAp f ~> DivAp g Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DivAp1 f ~> DivAp1 g Source # Source # Instance details Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Div1 f ~> Div1 g Source # Source # Instance details Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Div f ~> Div g Source # HFunctor (EnvT e :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> EnvT e f ~> EnvT e g Source # HFunctor (Day f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Day f f0 ~> Day f g Source # HFunctor (Day f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Day f f0 ~> Day f g Source # HFunctor (ReaderT r :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> ReaderT r f ~> ReaderT r g Source # HFunctor (These1 f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> These1 f f0 ~> These1 f g Source # HFunctor t => HFunctor (PostT t :: (Type -> Type) -> Type -> Type) Source # Since: 0.3.4.2 Instance detailsDefined in Data.HFunctor.Route Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> PostT t f ~> PostT t g Source # HFunctor t => HFunctor (PreT t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> PreT t f ~> PreT t g Source # HFunctor (Post a :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Post a f ~> Post a g Source # HFunctor (Pre a :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Pre a f ~> Pre a g Source # (HFunctor s, HFunctor t) => HFunctor (ComposeT s t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> ComposeT s t f ~> ComposeT s t g Source #

class HFunctor t => Inject t where Source #

A typeclass for HFunctors where you can "inject" an f a into a t f a:

inject :: f a -> t f a


If you think of t f a as an "enhanced f", then inject allows you to use an f as its enhanced form.

With the exception of directly pattern matching on the result, inject itself is not too useful in the general case without Interpret to allow us to interpret or retrieve back the f.

Methods

inject :: f ~> t f Source #

Lift from f into the enhanced t f structure. Analogous to lift from MonadTrans.

Note that this lets us "lift" a f a; if you want to lift an a with a -> t f a, check if t f is an instance of Applicative or Pointed.

#### Instances

Instances details
 Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodsinject :: forall (f :: k -> Type). f ~> DecAlt f Source # Source # Instance details Methodsinject :: forall (f :: k -> Type). f ~> Dec1 f Source # Source # Instance details Methodsinject :: forall (f :: k -> Type). f ~> Dec f Source # Source # Instance detailsDefined in Data.Functor.Apply.Free Methodsinject :: forall (f :: k -> Type). f ~> Ap1 f Source # Inject (Reverse :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> Reverse f Source # Inject (Backwards :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> Backwards f Source # Inject (IdentityT :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> IdentityT f Source # Inject (Flagged :: (k -> Type) -> k -> Type) Source # Injects with False.Equivalent to instance for EnvT Any and HLift IdentityT. Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> Flagged f Source # Inject (Steps :: (k -> Type) -> k -> Type) Source # Injects into a singleton map at 0; same behavior as NEMapF (Sum Natural). Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> Steps f Source # Inject (Step :: (k -> Type) -> k -> Type) Source # Injects with 0.Equivalent to instance for EnvT (Sum Natural). Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> Step f Source # Inject (MaybeF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> MaybeF f Source # Inject (NonEmptyF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> NonEmptyF f Source # Inject (ListF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> ListF f Source # Applicative f => Inject (Comp f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k -> Type). f0 ~> Comp f f0 Source # HFunctor t => Inject (HFree t :: (k -> Type) -> k -> Type) Source # HFree is the "free HBind and Inject" for any HFunctor Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> HFree t f Source # HFunctor t => Inject (HLift t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> HLift t f Source # Inject (ProxyF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> ProxyF f Source # Inject (Sum f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k0 -> Type). f0 ~> Sum f f0 Source # Inject ((:+:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k0 -> Type). f0 ~> (f :+: f0) Source # Monoid k2 => Inject (MapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Injects into a singleton map at mempty. Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> MapF k2 f Source # Monoid k2 => Inject (NEMapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Injects into a singleton map at mempty. Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> NEMapF k2 f Source # HBifunctor t => Inject (Chain1 t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodsinject :: forall (f :: k0 -> Type). f ~> Chain1 t f Source # Inject (Final c :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Final Methodsinject :: forall (f :: k0 -> Type). f ~> Final c f Source # Monoid e => Inject (ConstF e :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> ConstF e f Source # Inject (M1 i c :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k0 -> Type). f ~> M1 i c f Source # Applicative f => Inject ((:.:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k0 -> Type). f0 ~> (f :.: f0) Source # Inject t => Inject (WrapHF t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinject :: forall (f :: k0 -> Type). f ~> WrapHF t f Source # Inject (RightF g :: (k2 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodsinject :: forall (f :: k -> Type). f ~> RightF g f Source # Tensor t i => Inject (Chain t i :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Chain Methodsinject :: forall (f :: k -> Type). f ~> Chain t i f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Ap f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Ap f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Ap f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Alt f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Coyoneda f Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Coyoneda f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> WrappedApplicative f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> MaybeApply f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Lift f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Free1 f Source # Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> Free f Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodsinject :: forall (f :: k -> Type). f ~> DecAlt1 f Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodsinject :: forall (f :: k -> Type). f ~> DivAp f Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodsinject :: forall (f :: k -> Type). f ~> DivAp1 f Source # Source # Instance details Methodsinject :: forall (f :: k -> Type). f ~> Div1 f Source # Source # Instance details Methodsinject :: forall (f :: k -> Type). f ~> Div f Source # Monoid e => Inject (EnvT e :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> EnvT e f Source # Inject (ReaderT r :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> ReaderT r f Source # Inject (These1 f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k -> Type). f0 ~> These1 f f0 Source # Inject t => Inject (PostT t :: (Type -> Type) -> Type -> Type) Source # Since: 0.3.4.2 Instance detailsDefined in Data.HFunctor.Route Methodsinject :: forall (f :: k -> Type). f ~> PostT t f Source # Inject t => Inject (PreT t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodsinject :: forall (f :: k -> Type). f ~> PreT t f Source # Monoid a => Inject (Post a :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodsinject :: forall (f :: k -> Type). f ~> Post a f Source # a ~ Void => Inject (Pre a :: (Type -> Type) -> Type -> Type) Source # This instance is over-contrained (a only needs to be uninhabited), but there is no commonly used "uninhabited" typeclass Instance detailsDefined in Data.HFunctor.Route Methodsinject :: forall (f :: k -> Type). f ~> Pre a f Source # Plus f => Inject ((:*:) f :: (Type -> Type) -> Type -> Type) Source # Only uses zero Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k -> Type). f0 ~> (f :*: f0) Source # Plus f => Inject (Product f :: (Type -> Type) -> Type -> Type) Source # Only uses zero Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f0 :: k -> Type). f0 ~> Product f f0 Source # (Inject s, Inject t) => Inject (ComposeT s t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor Methodsinject :: forall (f :: k -> Type). f ~> ComposeT s t f Source #

class Inject t => Interpret t f where Source #

An Interpret lets us move in and out of the "enhanced" Functor (t f) and the functor it enhances (f). An instance Interpret t f means we have t f a -> f a.

For example, Free f is f enhanced with monadic structure. We get:

inject    :: f a -> Free f a
interpret :: Monad m => (forall x. f x -> m x) -> Free f a -> m a


inject will let us use our f inside the enhanced Free f. interpret will let us "extract" the f from a Free f if we can give an interpreting function that interprets f into some target Monad.

We enforce that:

interpret id . inject == id
-- or
retract . inject == id


That is, if we lift a value into our structure, then immediately interpret it out as itself, it should lave the value unchanged.

Note that instances of this class are intended to be written with t as a fixed type constructor, and f to be allowed to vary freely:

instance Monad f => Interpret Free f


Any other sort of instance and it's easy to run into problems with type inference. If you want to write an instance that's "polymorphic" on tensor choice, use the WrapHF newtype wrapper over a type variable, where the second argument also uses a type constructor:

instance Interpret (WrapHF t) (MyFunctor t)


This will prevent problems with overloaded instances.

Minimal complete definition

Methods

retract :: t f ~> f Source #

Remove the f out of the enhanced t f structure, provided that f satisfies the necessary constraints. If it doesn't, it needs to be properly interpreted out.

interpret :: (g ~> f) -> t g ~> f Source #

Given an "interpeting function" from f to g, interpret the f out of the t f into a final context g.

#### Instances

Instances details
 Decide f => Interpret Dec1 (f :: Type -> Type) Source # Instance details Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Dec1 g ~> f Source # Conclude f => Interpret Dec (f :: Type -> Type) Source # Instance details Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Dec g ~> f Source # Apply f => Interpret Ap1 (f :: Type -> Type) Source # Instance detailsDefined in Data.Functor.Apply.Free Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Ap1 g ~> f Source # Interpret (Reverse :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k0 -> Type). (g ~> f) -> Reverse g ~> f Source # Interpret (Backwards :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k0 -> Type). (g ~> f) -> Backwards g ~> f Source # Interpret (IdentityT :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k0 -> Type). (g ~> f) -> IdentityT g ~> f Source # Interpret (Flagged :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Equivalent to instance for EnvT Any and HLift IdentityT. Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k0 -> Type). (g ~> f) -> Flagged g ~> f Source # Interpret (Step :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Equivalent to instance for EnvT (Sum Natural). Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k0 -> Type). (g ~> f) -> Step g ~> f Source # (HBifunctor t, SemigroupIn t f) => Interpret (Chain1 t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Chain Methodsretract :: Chain1 t f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> Chain1 t g ~> f Source # Interpret t f => Interpret (HFree t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Never uses inject Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: HFree t f ~> f Source #interpret :: forall (g :: k0 -> Type). (g ~> f) -> HFree t g ~> f Source # Interpret t f => Interpret (HLift t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Never uses inject Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: HLift t f ~> f Source #interpret :: forall (g :: k0 -> Type). (g ~> f) -> HLift t g ~> f Source # c f => Interpret (Final c :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Instance detailsDefined in Data.HFunctor.Final Methodsretract :: Final c f ~> f Source #interpret :: forall (g :: k0 -> Type). (g ~> f) -> Final c g ~> f Source # Interpret (M1 i c :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: M1 i c f ~> f Source #interpret :: forall (g :: k0 -> Type). (g ~> f) -> M1 i c g ~> f Source # Interpret (RightF g :: (k2 -> Type) -> k2 -> Type) (f :: k2 -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodsretract :: RightF g f ~> f Source #interpret :: forall (g0 :: k -> Type). (g0 ~> f) -> RightF g g0 ~> f Source # MonoidIn t i f => Interpret (Chain t i :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # We can collapse and interpret an Chain t i if we have Tensor t. Instance detailsDefined in Data.HFunctor.Chain Methodsretract :: Chain t i f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> Chain t i g ~> f Source # Applicative f => Interpret Ap (f :: Type -> Type) Source # A free Applicative Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Ap g ~> f Source # Applicative f => Interpret Ap (f :: Type -> Type) Source # A free Applicative Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Ap g ~> f Source # Applicative f => Interpret Ap (f :: Type -> Type) Source # A free Applicative Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Ap g ~> f Source # Alternative f => Interpret Alt (f :: Type -> Type) Source # A free Alternative Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Alt g ~> f Source # Functor f => Interpret Coyoneda (f :: Type -> Type) Source # A free Functor Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Coyoneda g ~> f Source # Contravariant f => Interpret Coyoneda (f :: Type -> Type) Source # A free ContravariantSince: 0.3.0.0 Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Coyoneda g ~> f Source # Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> WrappedApplicative g ~> f Source # Pointed f => Interpret MaybeApply (f :: Type -> Type) Source # A free Pointed Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> MaybeApply g ~> f Source # Pointed f => Interpret Lift (f :: Type -> Type) Source # A free Pointed Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Lift g ~> f Source # Bind f => Interpret Free1 (f :: Type -> Type) Source # A free Bind Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Free1 g ~> f Source # Monad f => Interpret Free (f :: Type -> Type) Source # A free Monad Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Free g ~> f Source # Divise f => Interpret Div1 (f :: Type -> Type) Source # Instance details Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Div1 g ~> f Source # Divisible f => Interpret Div (f :: Type -> Type) Source # Instance details Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Div g ~> f Source # Monoid e => Interpret (EnvT e :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # This ignores the environment, so interpret /= hbind Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: EnvT e f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> EnvT e g ~> f Source # MonadReader r f => Interpret (ReaderT r :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # A free MonadReader, but only when applied to a Monad. Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: ReaderT r f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> ReaderT r g ~> f Source # Plus f => Interpret (These1 g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Technically, f is over-constrained: we only need zero :: f a, but we don't really have that typeclass in any standard hierarchies. We use Plus here instead, but we never use . This would only go wrong in situations where your type supports zero but not , like instances of MonadFail without MonadPlus. Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: These1 g f ~> f Source #interpret :: forall (g0 :: k -> Type). (g0 ~> f) -> These1 g g0 ~> f Source # Alt f => Interpret (Steps :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> Steps g ~> f Source # Plus f => Interpret (ListF :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # A free Plus Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> ListF g ~> f Source # Alt f => Interpret (NonEmptyF :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # A free Alt Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> NonEmptyF g ~> f Source # Plus f => Interpret (MaybeF :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Technically, f is over-constrained: we only need zero :: f a, but we don't really have that typeclass in any standard hierarchies. We use Plus here instead, but we never use . This would only go wrong in situations where your type supports zero but not , like instances of MonadFail without MonadPlus. Instance detailsDefined in Data.HFunctor.Interpret Methodsinterpret :: forall (g :: k -> Type). (g ~> f) -> MaybeF g ~> f Source # Interpret t f => Interpret (PostT t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Since: 0.3.4.2 Instance detailsDefined in Data.HFunctor.Route Methodsretract :: PostT t f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> PostT t g ~> f Source # Interpret t f => Interpret (PreT t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodsretract :: PreT t f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> PreT t g ~> f Source # Monoid a => Interpret (Post a :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodsretract :: Post a f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> Post a g ~> f Source # a ~ Void => Interpret (Pre a :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodsretract :: Pre a f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> Pre a g ~> f Source # Plus f => Interpret ((:+:) g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Technically, f is over-constrained: we only need zero :: f a, but we don't really have that typeclass in any standard hierarchies. We use Plus here instead, but we never use . This would only go wrong in situations where your type supports zero but not , like instances of MonadFail without MonadPlus. Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: (g :+: f) ~> f Source #interpret :: forall (g0 :: k -> Type). (g0 ~> f) -> (g :+: g0) ~> f Source # Plus g => Interpret ((:*:) g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: (g :*: f) ~> f Source #interpret :: forall (g0 :: k -> Type). (g0 ~> f) -> (g :*: g0) ~> f Source # Plus g => Interpret (Product g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: Product g f ~> f Source #interpret :: forall (g0 :: k -> Type). (g0 ~> f) -> Product g g0 ~> f Source # Plus f => Interpret (Sum g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Technically, f is over-constrained: we only need zero :: f a, but we don't really have that typeclass in any standard hierarchies. We use Plus here instead, but we never use . This would only go wrong in situations where your type supports zero but not , like instances of MonadFail without MonadPlus. Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: Sum g f ~> f Source #interpret :: forall (g0 :: k -> Type). (g0 ~> f) -> Sum g g0 ~> f Source # (Interpret s f, Interpret t f) => Interpret (ComposeT s t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: ComposeT s t f ~> f Source #interpret :: forall (g :: k -> Type). (g ~> f) -> ComposeT s t g ~> f Source # (Monoid k, Plus f) => Interpret (MapF k :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: MapF k f ~> f Source #interpret :: forall (g :: k0 -> Type). (g ~> f) -> MapF k g ~> f Source # (Monoid k, Alt f) => Interpret (NEMapF k :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsretract :: NEMapF k f ~> f Source #interpret :: forall (g :: k0 -> Type). (g ~> f) -> NEMapF k g ~> f Source #

forI :: Interpret t f => t g a -> (g ~> f) -> f a Source #

A convenient flipped version of interpret.

iget :: Interpret t (AltConst b) => (forall x. f x -> b) -> t f a -> b Source #

Useful wrapper over interpret to allow you to directly extract a value b out of the t f a, if you can convert f x into b.

Note that depending on the constraints on f in Interpret t f, you may have extra constraints on b.

• If f is unconstrained, there are no constraints on b
• If f must be Apply, Alt, Divise, or Decide, b needs to be an instance of Semigroup.
• If f is Applicative, Plus, Divisible, or Conclude, b needs to be an instance of Monoid

For some constraints (like Monad), this will not be usable.

-- get the length of the Map String in the Step.
icollect length
:: Step (Map String) Bool
-> Int


Note that in many cases, you can also use hfoldMap and hfoldMap1.

Since: 0.3.1.0

icollect :: (forall m. Monoid m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> [b] Source #

Useful wrapper over iget to allow you to collect a b from all instances of f inside a t f a.

Will work if there is an instance of Interpret t (AltConst m) if Monoid m, which will be the case if the constraint on the target functor is Functor, Apply, Applicative, Alt, Plus, Decide, Divisible, Decide, Conclude, or unconstrained.

-- get the lengths of all Map Strings in the Ap.
icollect length
:: Ap (Map String) Bool
-> [Int]


Note that in many cases, you can also use htoList.

Since: 0.3.1.0

icollect1 :: (forall m. Semigroup m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> NonEmpty b Source #

Useful wrapper over iget to allow you to collect a b from all instances of f inside a t f a, into a non-empty collection of bs.

Will work if there is an instance of Interpret t (AltConst m) if Semigroup m, which will be the case if the constraint on the target functor is Functor, Apply, Alt, Divise, Decide, or unconstrained.

-- get the lengths of all Map Strings in the Ap.
icollect1 length
:: Ap1 (Map String) Bool
-> NonEmpty Int


Note that in many cases, you can also use htoNonEmpty.

Since: 0.3.1.0

iapply :: Interpret t (Op b) => (forall x. f x -> x -> b) -> t f a -> a -> b Source #

Useful wrapper over interpret to allow you to directly consume a value of type a with a t f a to create a b. Do this by supplying the method by which each component f x can consume an x. This works for contravariant functor combinators, where t f a can be interpreted as a consumer of as.

Note that depending on the constraints on f in Interpret t f, you may have extra constraints on b.

• If f is unconstrained, Decide, or Conclude, there are no constraints on b. This will be the case for combinators like contravariant Coyoneda, Dec, Dec1.
• If f must be Divise, b needs to be an instance of Semigroup. This will be the case for combinators like Div1.
• If f is Divisible, b needs to be an instance of Monoid. This will be the case for combinators like Div.

For any Functor or Invariant constraint, this is not usable.

Since: 0.3.2.0

ifanout :: (forall m. Monoid m => Interpret t (Op m)) => (forall x. f x -> x -> b) -> t f a -> a -> [b] Source #

Useful wrapper over interpret to allow you to directly consume a value of type a with a t f a to create a b, and create a list of all the bs created by all the fs. Do this by supplying the method by which each component f x can consume an x. This works for contravariant functor combinators, where t f a can be interpreted as a consumer of as.

Will work if there is an instance of Interpret t (Op m) if Monoid m, which will be the case if the constraint on the target functor is Contravariant, Decide, Conclude, Divise, Divisible, or unconstrained.

Note that this is really only useful outside of iapply for Div and Div1, where a Div f which is a collection of many different fs consuming types of different values. You can use this with Dec and Dec1 and the contravarient Coyoneda as well, but those would always just give you a singleton list, so you might as well use iapply. This is really only here for completion alongside icollect, or if you define your own custom functor combinators.

ifanout1 :: (forall m. Semigroup m => Interpret t (Op m)) => (forall x. f x -> x -> b) -> t f a -> a -> NonEmpty b Source #

Useful wrapper over interpret to allow you to directly consume a value of type a with a t f a to create a b, and create a list of all the bs created by all the fs. Do this by supplying the method by which each component f x can consume an x. This works for contravariant functor combinators, where t f a can be interpreted as a consumer of as.

Will work if there is an instance of Interpret t (Op m) if Monoid m, which will be the case if the constraint on the target functor is Contravariant, Decide, Divise, or unconstrained.

Note that this is really only useful outside of iapply and ifanout for Div1, where a Div1 f which is a collection of many different fs consuming types of different values. You can use this with Dec and Dec1 and the contravarient Coyoneda as well, but those would always just give you a singleton list, so you might as well use iapply. This is really only here for completion alongside icollect1, or if you define your own custom functor combinators.

getI :: Interpret t (AltConst b) => (forall x. f x -> b) -> t f a -> b Source #

(Deprecated) Old name for getI; will be removed in a future version.

collectI :: (forall m. Monoid m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> [b] Source #

(Deprecated) Old name for icollect; will be removed in a future version.

injectMap :: (Inject t, Functor f) => (a -> b) -> f a -> t f b Source #

A useful wrapper over the common pattern of fmap-before-inject/inject-and-fmap.

Since: 0.3.3.0

injectContramap :: (Inject t, Contravariant f) => (a -> b) -> f b -> t f a Source #

A useful wrapper over the common pattern of contramap-before-inject/inject-and-contramap.

Since: 0.3.3.0

newtype AltConst w a Source #

A version of Const that supports Alt, Plus, Decide, and Conclude instances. It does this by avoiding having an Alternative or Decidable instance, which causes all sorts of problems with the interactions between Alternative/Applicative and Decidable/Divisible.

Since: 0.3.1.0

Constructors

 AltConst FieldsgetAltConst :: w

#### Instances

Instances details
 Functor (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsfmap :: (a -> b) -> AltConst w a -> AltConst w b #(<$) :: a -> AltConst w b -> AltConst w a # Monoid w => Applicative (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodspure :: a -> AltConst w a #(<*>) :: AltConst w (a -> b) -> AltConst w a -> AltConst w b #liftA2 :: (a -> b -> c) -> AltConst w a -> AltConst w b -> AltConst w c #(*>) :: AltConst w a -> AltConst w b -> AltConst w b #(<*) :: AltConst w a -> AltConst w b -> AltConst w a # Foldable (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsfold :: Monoid m => AltConst w m -> m #foldMap :: Monoid m => (a -> m) -> AltConst w a -> m #foldMap' :: Monoid m => (a -> m) -> AltConst w a -> m #foldr :: (a -> b -> b) -> b -> AltConst w a -> b #foldr' :: (a -> b -> b) -> b -> AltConst w a -> b #foldl :: (b -> a -> b) -> b -> AltConst w a -> b #foldl' :: (b -> a -> b) -> b -> AltConst w a -> b #foldr1 :: (a -> a -> a) -> AltConst w a -> a #foldl1 :: (a -> a -> a) -> AltConst w a -> a #toList :: AltConst w a -> [a] #null :: AltConst w a -> Bool #length :: AltConst w a -> Int #elem :: Eq a => a -> AltConst w a -> Bool #maximum :: Ord a => AltConst w a -> a #minimum :: Ord a => AltConst w a -> a #sum :: Num a => AltConst w a -> a #product :: Num a => AltConst w a -> a # Traversable (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodstraverse :: Applicative f => (a -> f b) -> AltConst w a -> f (AltConst w b) #sequenceA :: Applicative f => AltConst w (f a) -> f (AltConst w a) #mapM :: Monad m => (a -> m b) -> AltConst w a -> m (AltConst w b) #sequence :: Monad m => AltConst w (m a) -> m (AltConst w a) # Contravariant (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodscontramap :: (a -> b) -> AltConst w b -> AltConst w a #(>$) :: b -> AltConst w b -> AltConst w a # Eq w => Eq1 (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret MethodsliftEq :: (a -> b -> Bool) -> AltConst w a -> AltConst w b -> Bool # Ord w => Ord1 (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret MethodsliftCompare :: (a -> b -> Ordering) -> AltConst w a -> AltConst w b -> Ordering # Show w => Show1 (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret MethodsliftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> AltConst w a -> ShowS #liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [AltConst w a] -> ShowS # Monoid w => Divisible (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsdivide :: (a -> (b, c)) -> AltConst w b -> AltConst w c -> AltConst w a #conquer :: AltConst w a # Invariant (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsinvmap :: (a -> b) -> (b -> a) -> AltConst w a -> AltConst w b # Semigroup w => Apply (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methods(<.>) :: AltConst w (a -> b) -> AltConst w a -> AltConst w b #(.>) :: AltConst w a -> AltConst w b -> AltConst w b #(<.) :: AltConst w a -> AltConst w b -> AltConst w a #liftF2 :: (a -> b -> c) -> AltConst w a -> AltConst w b -> AltConst w c # Monoid w => Plus (AltConst w :: Type -> Type) Source # Unlike for Const, this is possible because there is no Alternative instance to complicate things. Instance detailsDefined in Data.HFunctor.Interpret Methodszero :: AltConst w a # Semigroup w => Alt (AltConst w :: Type -> Type) Source # Unlike for Const, this is possible because there is no Alternative instance to complicate things. Instance detailsDefined in Data.HFunctor.Interpret Methods() :: AltConst w a -> AltConst w a -> AltConst w a #some :: Applicative (AltConst w) => AltConst w a -> AltConst w [a] #many :: Applicative (AltConst w) => AltConst w a -> AltConst w [a] # Semigroup w => Divise (AltConst w :: Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsdivise :: (a -> (b, c)) -> AltConst w b -> AltConst w c -> AltConst w a Source # Semigroup w => Decide (AltConst w :: Type -> Type) Source # Unlike for Const, this is possible because there is no Decidable instance to complicate things. Instance detailsDefined in Data.HFunctor.Interpret Methodsdecide :: (a -> Either b c) -> AltConst w b -> AltConst w c -> AltConst w a Source # Monoid w => Conclude (AltConst w :: Type -> Type) Source # Unlike for Const, this is possible because there is no Decidable instance to complicate things. Instance detailsDefined in Data.HFunctor.Interpret Methodsconclude :: (a -> Void) -> AltConst w a Source # Eq w => Eq (AltConst w a) Source # Instance detailsDefined in Data.HFunctor.Interpret Methods(==) :: AltConst w a -> AltConst w a -> Bool #(/=) :: AltConst w a -> AltConst w a -> Bool # (Typeable a, Typeable k, Data w) => Data (AltConst w a) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AltConst w a -> c (AltConst w a) #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (AltConst w a) #toConstr :: AltConst w a -> Constr #dataTypeOf :: AltConst w a -> DataType #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (AltConst w a)) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (AltConst w a)) #gmapT :: (forall b. Data b => b -> b) -> AltConst w a -> AltConst w a #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AltConst w a -> r #gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AltConst w a -> r #gmapQ :: (forall d. Data d => d -> u) -> AltConst w a -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> AltConst w a -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> AltConst w a -> m (AltConst w a) #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AltConst w a -> m (AltConst w a) #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AltConst w a -> m (AltConst w a) # Ord w => Ord (AltConst w a) Source # Instance detailsDefined in Data.HFunctor.Interpret Methodscompare :: AltConst w a -> AltConst w a -> Ordering #(<) :: AltConst w a -> AltConst w a -> Bool #(<=) :: AltConst w a -> AltConst w a -> Bool #(>) :: AltConst w a -> AltConst w a -> Bool #(>=) :: AltConst w a -> AltConst w a -> Bool #max :: AltConst w a -> AltConst w a -> AltConst w a #min :: AltConst w a -> AltConst w a -> AltConst w a # Show w => Show (AltConst w a) Source # Instance detailsDefined in Data.HFunctor.Interpret MethodsshowsPrec :: Int -> AltConst w a -> ShowS #show :: AltConst w a -> String #showList :: [AltConst w a] -> ShowS # Generic (AltConst w a) Source # Instance detailsDefined in Data.HFunctor.Interpret Associated Typestype Rep (AltConst w a) :: Type -> Type # Methodsfrom :: AltConst w a -> Rep (AltConst w a) x #to :: Rep (AltConst w a) x -> AltConst w a # type Rep (AltConst w a) Source # Instance detailsDefined in Data.HFunctor.Interpret type Rep (AltConst w a) = D1 ('MetaData "AltConst" "Data.HFunctor.Interpret" "functor-combinators-0.3.6.0-inplace" 'True) (C1 ('MetaCons "AltConst" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAltConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 w)))

## HTraversable

class HFunctor t => HTraversable t where Source #

A higher-kinded version of Traversable, in the same way that HFunctor is the higher-kinded version of Functor. Gives you an "effectful" hmap, in the same way that traverse gives you an effectful fmap.

The typical analogues of Traversable laws apply.

Since: 0.3.6.0

Methods

htraverse :: Applicative h => (forall x. f x -> h (g x)) -> t f a -> h (t g a) Source #

An "effectful" hmap, in the same way that traverse is an effectful fmap.

#### Instances

Instances details
 Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> DecAlt f a -> h (DecAlt g a) Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> DecAlt1 f a -> h (DecAlt1 g a) Source # Source # Instance details Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Dec1 f a -> h (Dec1 g a) Source # Source # Instance details Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Dec f a -> h (Dec g a) Source # Source # Instance detailsDefined in Data.Functor.Apply.Free Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Ap1 f a -> h (Ap1 g a) Source # HTraversable (Night f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> Night f f0 a -> h (Night f g a) Source # HTraversable (Reverse :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Reverse f a -> h (Reverse g a) Source # HTraversable (Backwards :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Backwards f a -> h (Backwards g a) Source # HTraversable (IdentityT :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> IdentityT f a -> h (IdentityT g a) Source # HTraversable (Flagged :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Flagged f a -> h (Flagged g a) Source # HTraversable (Steps :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Steps f a -> h (Steps g a) Source # HTraversable (Step :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Step f a -> h (Step g a) Source # HTraversable (MaybeF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> MaybeF f a -> h (MaybeF g a) Source # HTraversable (NonEmptyF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> NonEmptyF f a -> h (NonEmptyF g a) Source # HTraversable (ListF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> ListF f a -> h (ListF g a) Source # HTraversable t => HTraversable (HFree t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> HFree t f a -> h (HFree t g a) Source # HTraversable t => HTraversable (HLift t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> HLift t f a -> h (HLift t g a) Source # HTraversable (ProxyF :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> ProxyF f a -> h (ProxyF g a) Source # HTraversable (Sum f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k0). Applicative h => (forall (x :: k1). f0 x -> h (g x)) -> Sum f f0 a -> h (Sum f g a) Source # HTraversable (Product f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k0). Applicative h => (forall (x :: k1). f0 x -> h (g x)) -> Product f f0 a -> h (Product f g a) Source # HTraversable ((:+:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k0). Applicative h => (forall (x :: k1). f0 x -> h (g x)) -> (f :+: f0) a -> h ((f :+: g) a) Source # HTraversable ((:*:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k0). Applicative h => (forall (x :: k1). f0 x -> h (g x)) -> (f :*: f0) a -> h ((f :*: g) a) Source # HTraversable (Void2 :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Void2 f a -> h (Void2 g a) Source # HTraversable (NEMapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> NEMapF k2 f a -> h (NEMapF k2 g a) Source # HTraversable (MapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> MapF k2 f a -> h (MapF k2 g a) Source # HTraversable (ConstF e :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> ConstF e f a -> h (ConstF e g a) Source # HTraversable (Joker f :: (k2 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> Joker f f0 a -> h (Joker f g a) Source # HTraversable (M1 i c :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> M1 i c f a -> h (M1 i c g a) Source # Traversable f => HTraversable ((:.:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k0). Applicative h => (forall (x :: k1). f0 x -> h (g x)) -> (f :.: f0) a -> h ((f :.: g) a) Source # HTraversable (LeftF f :: (k2 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> LeftF f f0 a -> h (LeftF f g a) Source # HTraversable (RightF g :: (k2 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodshtraverse :: forall h f g0 (a :: k). Applicative h => (forall (x :: k). f x -> h (g0 x)) -> RightF g f a -> h (RightF g g0 a) Source # HTraversable (Void3 f :: (k2 -> Type) -> k3 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> Void3 f f0 a -> h (Void3 f g a) Source # HTraversable (NS :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> NS f a -> h (NS g a) Source # HTraversable (NP :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> NP f a -> h (NP g a) Source # HTraversable (CoRec :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> CoRec f a -> h (CoRec g a) Source # HTraversable (Rec :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Rec f a -> h (Rec g a) Source # HTraversable (Tagged :: (k -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k0). Applicative h => (forall (x :: k1). f x -> h (g x)) -> Tagged f a -> h (Tagged g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> MaybeT f a -> h (MaybeT g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Ap f a -> h (Ap g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Ap f a -> h (Ap g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Ap f a -> h (Ap g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> AltF f a -> h (AltF g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Alt f a -> h (Alt g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Coyoneda f a -> h (Coyoneda g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Coyoneda f a -> h (Coyoneda g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> WrappedApplicative f a -> h (WrappedApplicative g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> MaybeApply f a -> h (MaybeApply g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Lift f a -> h (Lift g a) Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> DivAp f a -> h (DivAp g a) Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> DivAp1 f a -> h (DivAp1 g a) Source # Source # Instance details Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Div1 f a -> h (Div1 g a) Source # Source # Instance details Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Div f a -> h (Div g a) Source # HTraversable (EnvT e :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> EnvT e f a -> h (EnvT e g a) Source # HTraversable (Day f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> Day f f0 a -> h (Day f g a) Source # HTraversable (Day f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> Day f f0 a -> h (Day f g a) Source # HTraversable (These1 f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f0 g (a :: k). Applicative h => (forall (x :: k). f0 x -> h (g x)) -> These1 f f0 a -> h (These1 f g a) Source # HTraversable t => HTraversable (PostT t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> PostT t f a -> h (PostT t g a) Source # HTraversable t => HTraversable (PreT t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> PreT t f a -> h (PreT t g a) Source # HTraversable (Post a :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshtraverse :: forall h f g (a0 :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Post a f a0 -> h (Post a g a0) Source # HTraversable (Pre a :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Route Methodshtraverse :: forall h f g (a0 :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> Pre a f a0 -> h (Pre a g a0) Source # (HTraversable s, HTraversable t) => HTraversable (ComposeT s t :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse :: forall h f g (a :: k). Applicative h => (forall (x :: k). f x -> h (g x)) -> ComposeT s t f a -> h (ComposeT s t g a) Source #

hsequence :: (HTraversable t, Applicative h) => t (h :.: f) a -> h (t f a) Source #

A wrapper over a common pattern of "inverting" layers of a functor combinator.

Since: 0.3.6.0

hfoldMap :: (HTraversable t, Monoid m) => (forall x. f x -> m) -> t f a -> m Source #

Collect all the f xs inside a t f a into a monoidal result using a projecting function.

See iget.

Since: 0.3.6.0

htoList :: HTraversable t => (forall x. f x -> b) -> t f a -> [b] Source #

Collect all the f xs inside a t f a into a list, using a projecting function.

See icollect.

Since: 0.3.6.0

class HTraversable t => HTraversable1 t where Source #

A higher-kinded version of Traversable1, in the same way that HFunctor is the higher-kinded version of Functor. Gives you an "effectful" hmap, in the same way that traverse1 gives you an effectful fmap, guaranteeing at least one item.

The typical analogues of Traversable1 laws apply.

Since: 0.3.6.0

Methods

htraverse1 :: Apply h => (forall x. f x -> h (g x)) -> t f a -> h (t g a) Source #

An "effectful" hmap, in the same way that traverse1 is an effectful fmap, guaranteeing at least one item.

#### Instances

Instances details
 Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> DecAlt1 f a -> h (DecAlt1 g a) Source # Source # Instance details Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Dec1 f a -> h (Dec1 g a) Source # Source # Instance detailsDefined in Data.Functor.Apply.Free Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Ap1 f a -> h (Ap1 g a) Source # HTraversable1 (Night f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f0 g (a :: k). Apply h => (forall (x :: k). f0 x -> h (g x)) -> Night f f0 a -> h (Night f g a) Source # HTraversable1 (Reverse :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> Reverse f a -> h (Reverse g a) Source # HTraversable1 (IdentityT :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> IdentityT f a -> h (IdentityT g a) Source # HTraversable1 (Flagged :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> Flagged f a -> h (Flagged g a) Source # HTraversable1 (Steps :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> Steps f a -> h (Steps g a) Source # HTraversable1 (Step :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> Step f a -> h (Step g a) Source # HTraversable1 (NonEmptyF :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> NonEmptyF f a -> h (NonEmptyF g a) Source # HTraversable1 t => HTraversable1 (HFree t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> HFree t f a -> h (HFree t g a) Source # HTraversable1 t => HTraversable1 (HLift t :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> HLift t f a -> h (HLift t g a) Source # HTraversable1 (Product f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f0 g (a :: k0). Apply h => (forall (x :: k1). f0 x -> h (g x)) -> Product f f0 a -> h (Product f g a) Source # HTraversable1 ((:*:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f0 g (a :: k0). Apply h => (forall (x :: k1). f0 x -> h (g x)) -> (f :*: f0) a -> h ((f :*: g) a) Source # HTraversable1 (Void2 :: (k1 -> Type) -> k2 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Void2 f a -> h (Void2 g a) Source # HTraversable1 (NEMapF k2 :: (k1 -> Type) -> k1 -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> NEMapF k2 f a -> h (NEMapF k2 g a) Source # HTraversable1 (M1 i c :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> M1 i c f a -> h (M1 i c g a) Source # Traversable1 f => HTraversable1 ((:.:) f :: (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f0 g (a :: k0). Apply h => (forall (x :: k1). f0 x -> h (g x)) -> (f :.: f0) a -> h ((f :.: g) a) Source # HTraversable1 (NS :: (k -> Type) -> [k] -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k0). Apply h => (forall (x :: k1). f x -> h (g x)) -> NS f a -> h (NS g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> MaybeT f a -> h (MaybeT g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Coyoneda f a -> h (Coyoneda g a) Source # Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Coyoneda f a -> h (Coyoneda g a) Source # Source # Instance detailsDefined in Data.HFunctor.Chain.Internal Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> DivAp1 f a -> h (DivAp1 g a) Source # Source # Instance details Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Div1 f a -> h (Div1 g a) Source # HTraversable1 (EnvT e :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> EnvT e f a -> h (EnvT e g a) Source # HTraversable1 (Day f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f0 g (a :: k). Apply h => (forall (x :: k). f0 x -> h (g x)) -> Day f f0 a -> h (Day f g a) Source # HTraversable1 (Day f :: (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.HTraversable Methodshtraverse1 :: forall h f0 g (a :: k). Apply h => (forall (x :: k). f0 x -> h (g x)) -> Day f f0 a -> h (Day f g a) Source #

hsequence1 :: (HTraversable1 t, Apply h) => t (h :.: f) a -> h (t f a) Source #

A wrapper over a common pattern of "inverting" layers of a functor combinator that always contains at least one f item.

Since: 0.3.6.0

hfoldMap1 :: (HTraversable1 t, Semigroup m) => (forall x. f x -> m) -> t f a -> m Source #

Collect all the f xs inside a t f a into a semigroupoidal result using a projecting function.

See iget.

Since: 0.3.6.0

htoNonEmpty :: HTraversable1 t => (forall x. f x -> b) -> t f a -> NonEmpty b Source #

Collect all the f xs inside a t f a into a non-empty list, using a projecting function.

See icollect1.

Since: 0.3.6.0

## Multi-Functors

Classes that deal with two-functor combinators, that "mix" two functors together in some way.

class HBifunctor (t :: (k -> Type) -> (k -> Type) -> k -> Type) where Source #

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.

Minimal complete definition

Methods

hleft :: (f ~> j) -> t f g ~> t j g Source #

Swap out the first transformed functor.

hright :: (g ~> l) -> t f g ~> t f l Source #

Swap out the second transformed functor.

hbimap :: (f ~> j) -> (g ~> l) -> t f g ~> t j l Source #

Swap out both transformed functors at the same time.

#### Instances

Instances details
 Source # Since: 0.3.0.0 Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Night f g ~> Night j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Night f g ~> Night f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Night f g ~> Night j l Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Night f g ~> Night j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Night f g ~> Night f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Night f g ~> Night j l Source # HBifunctor (Sum :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Sum f g ~> Sum j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Sum f g ~> Sum f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Sum f g ~> Sum j l Source # HBifunctor ((:+:) :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> (f :+: g) ~> (j :+: g) Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> (f :+: g) ~> (f :+: l) Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> (f :+: g) ~> (j :+: l) Source # HBifunctor (Product :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Product f g ~> Product j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Product f g ~> Product f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Product f g ~> Product j l Source # HBifunctor ((:*:) :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> (f :*: g) ~> (j :*: g) Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> (f :*: g) ~> (f :*: l) Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> (f :*: g) ~> (j :*: l) Source # HBifunctor (Joker :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Joker f g ~> Joker j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Joker f g ~> Joker f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Joker f g ~> Joker j l Source # HBifunctor (LeftF :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> LeftF f g ~> LeftF j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> LeftF f g ~> LeftF f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> LeftF f g ~> LeftF j l Source # HBifunctor (RightF :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HBifunctor Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> RightF f g ~> RightF j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> RightF f g ~> RightF f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> RightF f g ~> RightF j l Source # HBifunctor (Void3 :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Void3 f g ~> Void3 j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Void3 f g ~> Void3 f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Void3 f g ~> Void3 j l Source # HBifunctor t => HBifunctor (WrapHBF t :: (k -> Type) -> (k -> Type) -> k -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Methodshleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> WrapHBF t f g ~> WrapHBF t j g Source #hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> WrapHBF t f g ~> WrapHBF t f l Source #hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> WrapHBF t f g ~> WrapHBF t j l Source # Source # Since: 0.3.4.0 Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Day f g ~> Day j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Day f g ~> Day f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Day f g ~> Day j l Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Day f g ~> Day j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Day f g ~> Day f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Day f g ~> Day j l Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Day f g ~> Day j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Day f g ~> Day f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Day f g ~> Day j l Source # Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> These1 f g ~> These1 j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> These1 f g ~> These1 f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> These1 f g ~> These1 j l Source # HBifunctor (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HFunctor.Internal Methodshleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Comp f g ~> Comp j g Source #hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Comp f g ~> Comp f l Source #hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Comp f g ~> Comp j l Source #

### Associative

class (HBifunctor t, Inject (NonEmptyBy t)) => Associative t where Source #

An HBifunctor where it doesn't matter which binds first is Associative. Knowing this gives us a lot of power to rearrange the internals of our HFunctor at will.

For example, for the functor product:

data (f :*: g) a = f a :*: g a


We know that f :*: (g :*: h) is the same as (f :*: g) :*: h.

Formally, we can say that t enriches a the category of endofunctors with semigroup strcture: it turns our endofunctor category into a "semigroupoidal category".

Different instances of t each enrich the endofunctor category in different ways, giving a different semigroupoidal category.

Minimal complete definition

Associated Types

type NonEmptyBy t :: (Type -> Type) -> Type -> Type Source #

The "semigroup functor combinator" generated by t.

A value of type NonEmptyBy t f a is equivalent to one of:

• f a
• t f f a
• t f (t f f) a
• t f (t f (t f f)) a
• t f (t f (t f (t f f))) a
• .. etc

For example, for :*:, we have NonEmptyF. This is because:

x             ~ NonEmptyF (x :| [])      ~ inject x
x :*: y       ~ NonEmptyF (x :| [y])     ~ toNonEmptyBy (x :*: y)
x :*: y :*: z ~ NonEmptyF (x :| [y,z])
-- etc.


You can create an "singleton" one with inject, or else one from a single t f f with toNonEmptyBy.

See ListBy for a "possibly empty" version of this type.

type FunctorBy t :: (Type -> Type) -> Constraint Source #

A description of "what type of Functor" this tensor is expected to be applied to. This should typically always be either Functor, Contravariant, or Invariant.

Since: 0.3.0.0

Methods

associating :: (FunctorBy t f, FunctorBy t g, FunctorBy t h) => t f (t g h) <~> t (t f g) h Source #

The isomorphism between t f (t g h) a and t (t f g) h a. To use this isomorphism, see assoc and disassoc.

appendNE :: t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f Source #

If a NonEmptyBy t f represents multiple applications of t f to itself, then we can also "append" two NonEmptyBy t fs applied to themselves into one giant NonEmptyBy t f containing all of the t fs.

Note that this essentially gives an instance for SemigroupIn t (NonEmptyBy t f), for any functor f.

matchNE :: FunctorBy t f => NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f)) Source #

If a NonEmptyBy t f represents multiple applications of t f to itself, then we can split it based on whether or not it is just a single f or at least one top-level application of t f.

Note that you can recursively "unroll" a NonEmptyBy completely into a Chain1 by using unrollNE.

consNE :: t f (NonEmptyBy t f) ~> NonEmptyBy t f Source #

Prepend an application of t f to the front of a NonEmptyBy t f.

toNonEmptyBy :: t f f ~> NonEmptyBy t f Source #

Embed a direct application of f to itself into a NonEmptyBy t f.

#### Instances

Instances details
 Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Day :: (Type -> Type) -> Type -> Type Source #type FunctorBy Day :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Day f, FunctorBy Day g, FunctorBy Day h) => Day f (Day g h) <~> Day (Day f g) h Source #appendNE :: forall (f :: Type -> Type). Day (NonEmptyBy Day f) (NonEmptyBy Day f) ~> NonEmptyBy Day f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Day f => NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f)) Source #consNE :: forall (f :: Type -> Type). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f Source #toNonEmptyBy :: forall (f :: Type -> Type). Day f f ~> NonEmptyBy Day f Source # Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Day :: (Type -> Type) -> Type -> Type Source #type FunctorBy Day :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Day f, FunctorBy Day g, FunctorBy Day h) => Day f (Day g h) <~> Day (Day f g) h Source #appendNE :: forall (f :: Type -> Type). Day (NonEmptyBy Day f) (NonEmptyBy Day f) ~> NonEmptyBy Day f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Day f => NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f)) Source #consNE :: forall (f :: Type -> Type). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f Source #toNonEmptyBy :: forall (f :: Type -> Type). Day f f ~> NonEmptyBy Day f Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Day :: (Type -> Type) -> Type -> Type Source #type FunctorBy Day :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Day f, FunctorBy Day g, FunctorBy Day h) => Day f (Day g h) <~> Day (Day f g) h Source #appendNE :: forall (f :: Type -> Type). Day (NonEmptyBy Day f) (NonEmptyBy Day f) ~> NonEmptyBy Day f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Day f => NonEmptyBy Day f ~> (f :+: Day f (NonEmptyBy Day f)) Source #consNE :: forall (f :: Type -> Type). Day f (NonEmptyBy Day f) ~> NonEmptyBy Day f Source #toNonEmptyBy :: forall (f :: Type -> Type). Day f f ~> NonEmptyBy Day f Source # Source # Ideally here NonEmptyBy would be equivalent to ListBy, just like for :+:. This should be possible if we can write a bijection. This bijection should be possible in theory --- but it has not yet been implemented. Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy These1 :: (Type -> Type) -> Type -> Type Source #type FunctorBy These1 :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy These1 f, FunctorBy These1 g, FunctorBy These1 h) => These1 f (These1 g h) <~> These1 (These1 f g) h Source #appendNE :: forall (f :: Type -> Type). These1 (NonEmptyBy These1 f) (NonEmptyBy These1 f) ~> NonEmptyBy These1 f Source #matchNE :: forall (f :: Type -> Type). FunctorBy These1 f => NonEmptyBy These1 f ~> (f :+: These1 f (NonEmptyBy These1 f)) Source #consNE :: forall (f :: Type -> Type). These1 f (NonEmptyBy These1 f) ~> NonEmptyBy These1 f Source #toNonEmptyBy :: forall (f :: Type -> Type). These1 f f ~> NonEmptyBy These1 f Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Night :: (Type -> Type) -> Type -> Type Source #type FunctorBy Night :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Night f, FunctorBy Night g, FunctorBy Night h) => Night f (Night g h) <~> Night (Night f g) h Source #appendNE :: forall (f :: Type -> Type). Night (NonEmptyBy Night f) (NonEmptyBy Night f) ~> NonEmptyBy Night f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Night f => NonEmptyBy Night f ~> (f :+: Night f (NonEmptyBy Night f)) Source #consNE :: forall (f :: Type -> Type). Night f (NonEmptyBy Night f) ~> NonEmptyBy Night f Source #toNonEmptyBy :: forall (f :: Type -> Type). Night f f ~> NonEmptyBy Night f Source # Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Night :: (Type -> Type) -> Type -> Type Source #type FunctorBy Night :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Night f, FunctorBy Night g, FunctorBy Night h) => Night f (Night g h) <~> Night (Night f g) h Source #appendNE :: forall (f :: Type -> Type). Night (NonEmptyBy Night f) (NonEmptyBy Night f) ~> NonEmptyBy Night f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Night f => NonEmptyBy Night f ~> (f :+: Night f (NonEmptyBy Night f)) Source #consNE :: forall (f :: Type -> Type). Night f (NonEmptyBy Night f) ~> NonEmptyBy Night f Source #toNonEmptyBy :: forall (f :: Type -> Type). Night f f ~> NonEmptyBy Night f Source # Associative ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy (:+:) :: (Type -> Type) -> Type -> Type Source #type FunctorBy (:+:) :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy (:+:) f, FunctorBy (:+:) g, FunctorBy (:+:) h) => (f :+: (g :+: h)) <~> ((f :+: g) :+: h) Source #appendNE :: forall (f :: Type -> Type). (NonEmptyBy (:+:) f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f Source #matchNE :: forall (f :: Type -> Type). FunctorBy (:+:) f => NonEmptyBy (:+:) f ~> (f :+: (f :+: NonEmptyBy (:+:) f)) Source #consNE :: forall (f :: Type -> Type). (f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f Source #toNonEmptyBy :: forall (f :: Type -> Type). (f :+: f) ~> NonEmptyBy (:+:) f Source # Associative ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy (:*:) :: (Type -> Type) -> Type -> Type Source #type FunctorBy (:*:) :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy (:*:) f, FunctorBy (:*:) g, FunctorBy (:*:) h) => (f :*: (g :*: h)) <~> ((f :*: g) :*: h) Source #appendNE :: forall (f :: Type -> Type). (NonEmptyBy (:*:) f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f Source #matchNE :: forall (f :: Type -> Type). FunctorBy (:*:) f => NonEmptyBy (:*:) f ~> (f :+: (f :*: NonEmptyBy (:*:) f)) Source #consNE :: forall (f :: Type -> Type). (f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f Source #toNonEmptyBy :: forall (f :: Type -> Type). (f :*: f) ~> NonEmptyBy (:*:) f Source # Associative (Product :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Product :: (Type -> Type) -> Type -> Type Source #type FunctorBy Product :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Product f, FunctorBy Product g, FunctorBy Product h) => Product f (Product g h) <~> Product (Product f g) h Source #appendNE :: forall (f :: Type -> Type). Product (NonEmptyBy Product f) (NonEmptyBy Product f) ~> NonEmptyBy Product f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Product f => NonEmptyBy Product f ~> (f :+: Product f (NonEmptyBy Product f)) Source #consNE :: forall (f :: Type -> Type). Product f (NonEmptyBy Product f) ~> NonEmptyBy Product f Source #toNonEmptyBy :: forall (f :: Type -> Type). Product f f ~> NonEmptyBy Product f Source # Associative (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Sum :: (Type -> Type) -> Type -> Type Source #type FunctorBy Sum :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Sum f, FunctorBy Sum g, FunctorBy Sum h) => Sum f (Sum g h) <~> Sum (Sum f g) h Source #appendNE :: forall (f :: Type -> Type). Sum (NonEmptyBy Sum f) (NonEmptyBy Sum f) ~> NonEmptyBy Sum f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Sum f => NonEmptyBy Sum f ~> (f :+: Sum f (NonEmptyBy Sum f)) Source #consNE :: forall (f :: Type -> Type). Sum f (NonEmptyBy Sum f) ~> NonEmptyBy Sum f Source #toNonEmptyBy :: forall (f :: Type -> Type). Sum f f ~> NonEmptyBy Sum f Source # Associative (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Comp :: (Type -> Type) -> Type -> Type Source #type FunctorBy Comp :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Comp f, FunctorBy Comp g, FunctorBy Comp h) => Comp f (Comp g h) <~> Comp (Comp f g) h Source #appendNE :: forall (f :: Type -> Type). Comp (NonEmptyBy Comp f) (NonEmptyBy Comp f) ~> NonEmptyBy Comp f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Comp f => NonEmptyBy Comp f ~> (f :+: Comp f (NonEmptyBy Comp f)) Source #consNE :: forall (f :: Type -> Type). Comp f (NonEmptyBy Comp f) ~> NonEmptyBy Comp f Source #toNonEmptyBy :: forall (f :: Type -> Type). Comp f f ~> NonEmptyBy Comp f Source # Associative (Joker :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Joker :: (Type -> Type) -> Type -> Type Source #type FunctorBy Joker :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Joker f, FunctorBy Joker g, FunctorBy Joker h) => Joker f (Joker g h) <~> Joker (Joker f g) h Source #appendNE :: forall (f :: Type -> Type). Joker (NonEmptyBy Joker f) (NonEmptyBy Joker f) ~> NonEmptyBy Joker f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Joker f => NonEmptyBy Joker f ~> (f :+: Joker f (NonEmptyBy Joker f)) Source #consNE :: forall (f :: Type -> Type). Joker f (NonEmptyBy Joker f) ~> NonEmptyBy Joker f Source #toNonEmptyBy :: forall (f :: Type -> Type). Joker f f ~> NonEmptyBy Joker f Source # Associative (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy LeftF :: (Type -> Type) -> Type -> Type Source #type FunctorBy LeftF :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy LeftF f, FunctorBy LeftF g, FunctorBy LeftF h) => LeftF f (LeftF g h) <~> LeftF (LeftF f g) h Source #appendNE :: forall (f :: Type -> Type). LeftF (NonEmptyBy LeftF f) (NonEmptyBy LeftF f) ~> NonEmptyBy LeftF f Source #matchNE :: forall (f :: Type -> Type). FunctorBy LeftF f => NonEmptyBy LeftF f ~> (f :+: LeftF f (NonEmptyBy LeftF f)) Source #consNE :: forall (f :: Type -> Type). LeftF f (NonEmptyBy LeftF f) ~> NonEmptyBy LeftF f Source #toNonEmptyBy :: forall (f :: Type -> Type). LeftF f f ~> NonEmptyBy LeftF f Source # Associative (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy RightF :: (Type -> Type) -> Type -> Type Source #type FunctorBy RightF :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy RightF f, FunctorBy RightF g, FunctorBy RightF h) => RightF f (RightF g h) <~> RightF (RightF f g) h Source #appendNE :: forall (f :: Type -> Type). RightF (NonEmptyBy RightF f) (NonEmptyBy RightF f) ~> NonEmptyBy RightF f Source #matchNE :: forall (f :: Type -> Type). FunctorBy RightF f => NonEmptyBy RightF f ~> (f :+: RightF f (NonEmptyBy RightF f)) Source #consNE :: forall (f :: Type -> Type). RightF f (NonEmptyBy RightF f) ~> NonEmptyBy RightF f Source #toNonEmptyBy :: forall (f :: Type -> Type). RightF f f ~> NonEmptyBy RightF f Source # Associative (Void3 :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy Void3 :: (Type -> Type) -> Type -> Type Source #type FunctorBy Void3 :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Void3 f, FunctorBy Void3 g, FunctorBy Void3 h) => Void3 f (Void3 g h) <~> Void3 (Void3 f g) h Source #appendNE :: forall (f :: Type -> Type). Void3 (NonEmptyBy Void3 f) (NonEmptyBy Void3 f) ~> NonEmptyBy Void3 f Source #matchNE :: forall (f :: Type -> Type). FunctorBy Void3 f => NonEmptyBy Void3 f ~> (f :+: Void3 f (NonEmptyBy Void3 f)) Source #consNE :: forall (f :: Type -> Type). Void3 f (NonEmptyBy Void3 f) ~> NonEmptyBy Void3 f Source #toNonEmptyBy :: forall (f :: Type -> Type). Void3 f f ~> NonEmptyBy Void3 f Source # Source # Instance detailsDefined in Data.HBifunctor.Associative Associated Typestype NonEmptyBy (WrapHBF t) :: (Type -> Type) -> Type -> Type Source #type FunctorBy (WrapHBF t) :: (Type -> Type) -> Constraint Source # Methodsassociating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy (WrapHBF t) f, FunctorBy (WrapHBF t) g, FunctorBy (WrapHBF t) h) => WrapHBF t f (WrapHBF t g h) <~> WrapHBF t (WrapHBF t f g) h Source #appendNE :: forall (f :: Type -> Type). WrapHBF t (NonEmptyBy (WrapHBF t) f) (NonEmptyBy (WrapHBF t) f) ~> NonEmptyBy (WrapHBF t) f Source #matchNE :: forall (f :: Type -> Type). FunctorBy (WrapHBF t) f => NonEmptyBy (WrapHBF t) f ~> (f :+: WrapHBF t f (NonEmptyBy (WrapHBF t) f)) Source #consNE :: forall (f :: Type -> Type). WrapHBF t f (NonEmptyBy (WrapHBF t) f) ~> NonEmptyBy (WrapHBF t) f Source #toNonEmptyBy :: forall (f :: Type -> Type). WrapHBF t f f ~> NonEmptyBy (WrapHBF t) f Source #

class (Associative t, FunctorBy t f) => SemigroupIn t f where Source #

For different Associative t, we have functors f that we can "squash", using biretract:

t f f ~> f


This gives us the ability to squash applications of t.

Formally, if we have Associative t, we are enriching the category of endofunctors with semigroup structure, turning it into a semigroupoidal category. Different choices of t give different semigroupoidal categories.

A functor f is known as a "semigroup in the (semigroupoidal) category of endofunctors on t" if we can biretract:

t f f ~> f


This gives us a few interesting results in category theory, which you can stil reading about if you don't care:

• All functors are semigroups in the semigroupoidal category on :+:
• The class of functors that are semigroups in the semigroupoidal category on :*: is exactly the functors that are instances of Alt.
• The class of functors that are semigroups in the semigroupoidal category on Day is exactly the functors that are instances of Apply.
• The class of functors that are semigroups in the semigroupoidal category on Comp is exactly the functors that are instances of Bind.

Note that instances of this class are intended to be written with t as a fixed type constructor, and f to be allowed to vary freely:

instance Bind f => SemigroupIn Comp f


Any other sort of instance and it's easy to run into problems with type inference. If you want to write an instance that's "polymorphic" on tensor choice, use the WrapHBF newtype wrapper over a type variable, where the second argument also uses a type constructor:

instance SemigroupIn (WrapHBF t) (MyFunctor t i)


This will prevent problems with overloaded instances.

Minimal complete definition

Nothing

Methods

biretract :: t f f ~> f Source #

The HBifunctor analogy of retract. It retracts both fs into a single f, effectively fully mixing them together.

This function makes f a semigroup in the category of endofunctors with respect to tensor t.

default biretract :: Interpret (NonEmptyBy t) f => t f f ~> f Source #

binterpret :: (g ~> f) -> (h ~> f) -> t g h ~> f Source #

The HBifunctor analogy of interpret. It takes two interpreting functions, and mixes them together into a target functor h.

Note that this is useful in the poly-kinded case, but it is not possible to define generically for all SemigroupIn because it only is defined for Type -> Type inputes. See !+! for a version that is poly-kinded for :+: in specific.

default binterpret :: Interpret (NonEmptyBy t) f => (g ~> f) -> (h ~> f) -> t g h ~> f Source #

#### Instances

Instances details
 Apply f => SemigroupIn Day f Source # Instances of Apply are semigroups in the semigroupoidal category on Day. Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Day f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Day g h ~> f Source # Divise f => SemigroupIn Day f Source # Since: 0.3.0.0 Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Day f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Day g h ~> f Source # Alt f => SemigroupIn These1 f Source # Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: These1 f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> These1 g h ~> f Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Night f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Night g h ~> f Source # SemigroupIn ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # All functors are semigroups in the semigroupoidal category on :+:. Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: (f :+: f) ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> (g :+: h) ~> f Source # Alt f => SemigroupIn ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # Instances of Alt are semigroups in the semigroupoidal category on :*:. Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: (f :*: f) ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> (g :*: h) ~> f Source # Alt f => SemigroupIn (Product :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # Instances of Alt are semigroups in the semigroupoidal category on Product. Instance detailsDefined in Data.HBifunctor.Associative Methodsbinterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Product g h ~> f Source # SemigroupIn (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # All functors are semigroups in the semigroupoidal category on Sum. Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Sum f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Sum g h ~> f Source # Bind f => SemigroupIn (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # Instances of Bind are semigroups in the semigroupoidal category on Comp. Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Comp f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Comp g h ~> f Source # SemigroupIn (Joker :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Joker f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Joker g h ~> f Source # SemigroupIn (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: LeftF f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> LeftF g h ~> f Source # SemigroupIn (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: RightF f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> RightF g h ~> f Source # SemigroupIn (Void3 :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # All functors are semigroups in the semigroupoidal category on Void3. Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: Void3 f f ~> f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> f) -> (h ~> f) -> Void3 g h ~> f Source # (Associative t, FunctorBy t f, FunctorBy t (WrapNE t f)) => SemigroupIn (WrapHBF t) (WrapNE t f) Source # Instance detailsDefined in Data.HBifunctor.Associative Methodsbiretract :: WrapHBF t (WrapNE t f) (WrapNE t f) ~> WrapNE t f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> WrapNE t f) -> (h ~> WrapNE t f) -> WrapHBF t g h ~> WrapNE t f Source # (Tensor t i, FunctorBy t f, FunctorBy t (WrapLB t f)) => SemigroupIn (WrapHBF t) (WrapLB t f) Source # Instance detailsDefined in Data.HBifunctor.Tensor Methodsbiretract :: WrapHBF t (WrapLB t f) (WrapLB t f) ~> WrapLB t f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> WrapLB t f) -> (h ~> WrapLB t f) -> WrapHBF t g h ~> WrapLB t f Source # (Associative t, FunctorBy t f, FunctorBy t (Chain1 t f)) => SemigroupIn (WrapHBF t) (Chain1 t f) Source # Chain1 t is the "free SemigroupIn t". However, we have to wrap t in WrapHBF to prevent overlapping instances. Instance detailsDefined in Data.HFunctor.Chain Methodsbiretract :: WrapHBF t (Chain1 t f) (Chain1 t f) ~> Chain1 t f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> Chain1 t f) -> (h ~> Chain1 t f) -> WrapHBF t g h ~> Chain1 t f Source # (Tensor t i, FunctorBy t (Chain t i f)) => SemigroupIn (WrapHBF t) (Chain t i f) Source # We have to wrap t in WrapHBF to prevent overlapping instances. Instance detailsDefined in Data.HFunctor.Chain Methodsbiretract :: WrapHBF t (Chain t i f) (Chain t i f) ~> Chain t i f Source #binterpret :: forall (g :: Type -> Type) (h :: Type -> Type). (g ~> Chain t i f) -> (h ~> Chain t i f) -> WrapHBF t g h ~> Chain t i f Source #

biget :: SemigroupIn t (AltConst b) => (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b Source #

Useful wrapper over binterpret to allow you to directly extract a value b out of the t f g a, if you can convert an f x and g x into b.

Note that depending on the constraints on h in SemigroupIn t h, you may have extra constraints on b.

• If h is unconstrained, there are no constraints on b
• If h must be Apply, Alt, Divise, or Decide, b needs to be an instance of Semigroup
• If h is Applicative, Plus, Divisible, or Conclude, b needs to be an instance of Monoid

For some constraints (like Monad), this will not be usable.

-- Return the length of either the list, or the Map, depending on which
--   one s in the +
biget length length
:: ([] :+: Map Int) Char
-> Int

-- Return the length of both the list and the map, added together
biget (Sum . length) (Sum . length)
:: Day [] (Map Int) Char
-> Sum Int


biapply :: SemigroupIn t (Op b) => (forall x. f x -> x -> b) -> (forall x. g x -> x -> b) -> t f g a -> a -> b Source #

Useful wrapper over binterpret to allow you to directly extract a value b out of the t f g a, if you can convert an f x and g x into b, given an x input.

Note that depending on the constraints on h in SemigroupIn t h, you may have extra constraints on b.

• If h is unconstrained, there are no constraints on b
• If h must be Divise, or Divisible, b needs to be an instance of Semigroup
• If h must be Divisible, then b needs to be an instance of Monoid.

For some constraints (like Monad), this will not be usable.

Since: 0.3.2.0

(!*!) :: SemigroupIn t h => (f ~> h) -> (g ~> h) -> t f g ~> h infixr 5 Source #

Infix alias for binterpret

Note that this is useful in the poly-kinded case, but it is not possible to define generically for all SemigroupIn because it only is defined for Type -> Type inputes. See !+! for a version that is poly-kinded for :+: in specific.

(!+!) :: (f ~> h) -> (g ~> h) -> (f :+: g) ~> h infixr 5 Source #

A version of !*! specifically for :+: that is poly-kinded

(!$!) :: SemigroupIn t (AltConst b) => (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b infixr 5 Source # Infix alias for biget -- Return the length of either the list, or the Map, depending on which -- one s in the + length !$! length
:: ([] :+: Map Int) Char
-> Int

-- Return the length of both the list and the map, added together
Sum . length !\$! Sum . length
:: Day [] (Map Int) Char
-> Sum Int


### Tensor

class (Associative t, Inject (ListBy t)) => Tensor t i | t -> i where Source #

An Associative HBifunctor can be a Tensor if there is some identity i where t i f and t f i are equivalent to just f.

That is, "enhancing" f with t i does nothing.

The methods in this class provide us useful ways of navigating a Tensor t with respect to this property.

The Tensor is essentially the HBifunctor equivalent of Inject, with intro1 and intro2 taking the place of inject.

Formally, we can say that t enriches a the category of endofunctors with monoid strcture: it turns our endofunctor category into a "monoidal category".

Different instances of t each enrich the endofunctor category in different ways, giving a different monoidal category.

Minimal complete definition

Associated Types

type ListBy t :: (Type -> Type) -> Type -> Type Source #

The "monoidal functor combinator" induced by t.

A value of type ListBy t f a is equivalent to one of:

• I a -- zero fs
• f a -- one f
• t f f a -- two fs
• t f (t f f) a -- three fs
• t f (t f (t f f)) a
• t f (t f (t f (t f f))) a
• .. etc

For example, for :*:, we have ListF. This is because:

Proxy         ~ ListF []         ~ nilLB @(:*:)
x             ~ ListF [x]        ~ inject x
x :*: y       ~ ListF [x,y]      ~ toListBy (x :*: y)
x :*: y :*: z ~ ListF [x,y,z]
-- etc.


You can create an "empty" one with nilLB, a "singleton" one with inject, or else one from a single t f f with toListBy.

See NonEmptyBy for a "non-empty" version of this type.

Methods

intro1 :: f ~> t f i Source #

Because t f (I t) is equivalent to f, we can always "insert" f into t f (I t).

This is analogous to inject from Inject, but for HBifunctors.

intro2 :: g ~> t i g Source #

Because t (I t) g is equivalent to f, we can always "insert" g into t (I t) g.

This is analogous to inject from Inject, but for HBifunctors.

elim1 :: FunctorBy t f => t f i ~> f Source #

Witnesses the property that i is the identity of t: t f i always leaves f unchanged, so we can always just drop the i.

elim2 :: FunctorBy t g => t i g ~> g Source #

Witnesses the property that i is the identity of t: t i g always leaves g unchanged, so we can always just drop the i t.

appendLB :: t (ListBy t f) (ListBy t f) ~> ListBy t f Source #

If a ListBy t f represents multiple applications of t f to itself, then we can also "append" two ListBy t fs applied to themselves into one giant ListBy t f containing all of the t fs.

Note that this essentially gives an instance for SemigroupIn t (ListBy t f), for any functor f; this is witnessed by WrapLB.

splitNE :: NonEmptyBy t f ~> t f (ListBy t f) Source #

Lets you convert an NonEmptyBy t f into a single application of f to ListBy t f.

Analogous to a function NonEmpty a -> (a, [a])

Note that this is not reversible in general unless we have Matchable t.

splittingLB :: ListBy t f <~> (i :+: t f (ListBy t f)) Source #

An ListBy t f is either empty, or a single application of t to f and ListBy t f (the "head" and "tail"). This witnesses that isomorphism.

To use this property, see nilLB, consLB, and unconsLB.

toListBy :: t f f ~> ListBy t f Source #

Embed a direct application of f to itself into a ListBy t f.

fromNE :: NonEmptyBy t f ~> ListBy t f Source #

NonEmptyBy t f is "one or more fs", and 'ListBy t f is "zero or more fs". This function lets us convert from one to the other.

This is analogous to a function NonEmpty a -> [a].

Note that because t is not inferrable from the input or output type, you should call this using -XTypeApplications:

fromNE @(:*:) :: NonEmptyF f a -> ListF f a
fromNE @Comp  :: Free1 f a -> Free f a


#### Instances

Instances details
 Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Day :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Day f Identity Source #intro2 :: forall (g :: Type -> Type). g ~> Day Identity g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Day f => Day f Identity ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Day g => Day Identity g ~> g Source #appendLB :: forall (f :: Type -> Type). Day (ListBy Day f) (ListBy Day f) ~> ListBy Day f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Day f ~> Day f (ListBy Day f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Day f <~> (Identity :+: Day f (ListBy Day f)) Source #toListBy :: forall (f :: Type -> Type). Day f f ~> ListBy Day f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Day f ~> ListBy Day f Source # Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Day :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Day f Identity Source #intro2 :: forall (g :: Type -> Type). g ~> Day Identity g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Day f => Day f Identity ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Day g => Day Identity g ~> g Source #appendLB :: forall (f :: Type -> Type). Day (ListBy Day f) (ListBy Day f) ~> ListBy Day f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Day f ~> Day f (ListBy Day f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Day f <~> (Identity :+: Day f (ListBy Day f)) Source #toListBy :: forall (f :: Type -> Type). Day f f ~> ListBy Day f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Day f ~> ListBy Day f Source # Source # Since: 0.3.0.0 Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Night :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Night f Not Source #intro2 :: forall (g :: Type -> Type). g ~> Night Not g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Night f => Night f Not ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Night g => Night Not g ~> g Source #appendLB :: forall (f :: Type -> Type). Night (ListBy Night f) (ListBy Night f) ~> ListBy Night f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Night f ~> Night f (ListBy Night f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Night f <~> (Not :+: Night f (ListBy Night f)) Source #toListBy :: forall (f :: Type -> Type). Night f f ~> ListBy Night f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Night f ~> ListBy Night f Source # Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Night :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Night f Not Source #intro2 :: forall (g :: Type -> Type). g ~> Night Not g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Night f => Night f Not ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Night g => Night Not g ~> g Source #appendLB :: forall (f :: Type -> Type). Night (ListBy Night f) (ListBy Night f) ~> ListBy Night f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Night f ~> Night f (ListBy Night f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Night f <~> (Not :+: Night f (ListBy Night f)) Source #toListBy :: forall (f :: Type -> Type). Night f f ~> ListBy Night f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Night f ~> ListBy Night f Source # Tensor Day (Proxy :: Type -> Type) Source # Since: 0.3.0.0 Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Day :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Day f Proxy Source #intro2 :: forall (g :: Type -> Type). g ~> Day Proxy g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Day f => Day f Proxy ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Day g => Day Proxy g ~> g Source #appendLB :: forall (f :: Type -> Type). Day (ListBy Day f) (ListBy Day f) ~> ListBy Day f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Day f ~> Day f (ListBy Day f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Day f <~> (Proxy :+: Day f (ListBy Day f)) Source #toListBy :: forall (f :: Type -> Type). Day f f ~> ListBy Day f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Day f ~> ListBy Day f Source # Tensor These1 (V1 :: Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy These1 :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> These1 f V1 Source #intro2 :: forall (g :: Type -> Type). g ~> These1 V1 g Source #elim1 :: forall (f :: Type -> Type). FunctorBy These1 f => These1 f V1 ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy These1 g => These1 V1 g ~> g Source #appendLB :: forall (f :: Type -> Type). These1 (ListBy These1 f) (ListBy These1 f) ~> ListBy These1 f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy These1 f ~> These1 f (ListBy These1 f) Source #splittingLB :: forall (f :: Type -> Type). ListBy These1 f <~> (V1 :+: These1 f (ListBy These1 f)) Source #toListBy :: forall (f :: Type -> Type). These1 f f ~> ListBy These1 f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy These1 f ~> ListBy These1 f Source # Tensor (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Comp :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Comp f Identity Source #intro2 :: forall (g :: Type -> Type). g ~> Comp Identity g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Comp f => Comp f Identity ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Comp g => Comp Identity g ~> g Source #appendLB :: forall (f :: Type -> Type). Comp (ListBy Comp f) (ListBy Comp f) ~> ListBy Comp f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Comp f ~> Comp f (ListBy Comp f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Comp f <~> (Identity :+: Comp f (ListBy Comp f)) Source #toListBy :: forall (f :: Type -> Type). Comp f f ~> ListBy Comp f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Comp f ~> ListBy Comp f Source # Tensor ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy (:+:) :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> (f :+: V1) Source #intro2 :: forall (g :: Type -> Type). g ~> (V1 :+: g) Source #elim1 :: forall (f :: Type -> Type). FunctorBy (:+:) f => (f :+: V1) ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy (:+:) g => (V1 :+: g) ~> g Source #appendLB :: forall (f :: Type -> Type). (ListBy (:+:) f :+: ListBy (:+:) f) ~> ListBy (:+:) f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy (:+:) f ~> (f :+: ListBy (:+:) f) Source #splittingLB :: forall (f :: Type -> Type). ListBy (:+:) f <~> (V1 :+: (f :+: ListBy (:+:) f)) Source #toListBy :: forall (f :: Type -> Type). (f :+: f) ~> ListBy (:+:) f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy (:+:) f ~> ListBy (:+:) f Source # Tensor ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy (:*:) :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> (f :*: Proxy) Source #intro2 :: forall (g :: Type -> Type). g ~> (Proxy :*: g) Source #elim1 :: forall (f :: Type -> Type). FunctorBy (:*:) f => (f :*: Proxy) ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy (:*:) g => (Proxy :*: g) ~> g Source #appendLB :: forall (f :: Type -> Type). (ListBy (:*:) f :*: ListBy (:*:) f) ~> ListBy (:*:) f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy (:*:) f ~> (f :*: ListBy (:*:) f) Source #splittingLB :: forall (f :: Type -> Type). ListBy (:*:) f <~> (Proxy :+: (f :*: ListBy (:*:) f)) Source #toListBy :: forall (f :: Type -> Type). (f :*: f) ~> ListBy (:*:) f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy (:*:) f ~> ListBy (:*:) f Source # Tensor (Product :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) Source # Instance detailsDefined in Data.HBifunctor.Tensor Associated Typestype ListBy Product :: (Type -> Type) -> Type -> Type Source # Methodsintro1 :: forall (f :: Type -> Type). f ~> Product f Proxy Source #intro2 :: forall (g :: Type -> Type). g ~> Product Proxy g Source #elim1 :: forall (f :: Type -> Type). FunctorBy Product f => Product f Proxy ~> f Source #elim2 :: forall (g :: Type -> Type). FunctorBy Product g => Product Proxy g ~> g Source #appendLB :: forall (f :: Type -> Type). Product (ListBy Product f) (ListBy Product f) ~> ListBy Product f Source #splitNE :: forall (f :: Type -> Type). NonEmptyBy Product f ~> Product f (ListBy Product f) Source #splittingLB :: forall (f :: Type -> Type). ListBy Product f <~> (Proxy :+: Product f (ListBy Product f)) Source #toListBy :: forall (f :: Type -> Type). Product f f ~> ListBy Product f Source #fromNE :: forall (f :: Type -> Type). NonEmptyBy Product f ~> ListBy Product f Source # Tensor (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 ::