functor-combinators-0.4.1.1: Tools for functor combinator-based program design
Copyright(c) Justin Le 2019
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.HFunctor

Description

This module provides abstractions for working with unary functor combinators.

Principally, it defines the HFunctor itself, as well as some classes that expose extra functionality that some HFunctors have (Inject and HBind).

See Data.HFunctor.Interpret for tools to use HFunctors as functor combinators that can represent interpretable schemas, and Data.HBifunctor for an abstraction over binary functor combinators.

Synopsis

Documentation

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
HFunctor Ap Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap f ~> Ap g Source #

HFunctor Ap Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap f ~> Ap g Source #

HFunctor F Source #

Note that there is no Interpret or Bind instance, because inject requires Functor f.

Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> F f ~> F g Source #

HFunctor Free Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Free f ~> Free g Source #

HFunctor Free1 Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Free1 f ~> Free1 g Source #

HFunctor Ap1 Source # 
Instance details

Defined in Data.Functor.Apply.Free

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap1 f ~> Ap1 g Source #

HFunctor Dec Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Dec f ~> Dec g Source #

HFunctor Dec1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Dec1 f ~> Dec1 g Source #

HFunctor Coyoneda Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Coyoneda f ~> Coyoneda g Source #

HFunctor Coyoneda Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Coyoneda f ~> Coyoneda g Source #

HFunctor Yoneda Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Yoneda f ~> Yoneda g Source #

HFunctor MaybeApply Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> MaybeApply f ~> MaybeApply g Source #

HFunctor WrappedApplicative Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> WrappedApplicative f ~> WrappedApplicative g Source #

HFunctor Lift Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Lift f ~> Lift g Source #

HFunctor MaybeT Source #

Note that there is no Interpret or Bind instance, because inject requires Functor f.

Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> MaybeT f ~> MaybeT g Source #

HFunctor (EnvT e :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> EnvT e f ~> EnvT e g Source #

HFunctor (Night f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Night f f0 ~> Night f g Source #

HFunctor (Post a :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Route

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Post a f ~> Post a g Source #

HFunctor t => HFunctor (PostT t :: (Type -> Type) -> Type -> Type) Source #

Since: 0.3.4.2

Instance details

Defined in Data.HFunctor.Route

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> PostT t f ~> PostT t g Source #

HFunctor (Pre a :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Route

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Pre a f ~> Pre a g Source #

HFunctor t => HFunctor (PreT t :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Route

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> PreT t f ~> PreT t g Source #

HFunctor (Day f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Day f f0 ~> Day f g Source #

HFunctor (These1 f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> These1 f f0 ~> These1 f g Source #

HFunctor (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> ReaderT r f ~> ReaderT r g Source #

HFunctor (Tagged :: (k -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Tagged f ~> Tagged g Source #

HFunctor (ListF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> ListF f ~> ListF g Source #

HFunctor (MaybeF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> MaybeF f ~> MaybeF g Source #

HFunctor (NonEmptyF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> NonEmptyF f ~> NonEmptyF g Source #

HFunctor (Flagged :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Flagged f ~> Flagged g Source #

HFunctor (Step :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Step f ~> Step g Source #

HFunctor (Steps :: (k -> TYPE LiftedRep) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Steps f ~> Steps g Source #

HFunctor (Backwards :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Backwards f ~> Backwards g Source #

HFunctor (IdentityT :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> IdentityT f ~> IdentityT g Source #

HFunctor (Reverse :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Reverse f ~> Reverse g Source #

(HFunctor s, HFunctor t) => HFunctor (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> ComposeT s t f ~> ComposeT s t g Source #

HFunctor (Product f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> Product f f0 ~> Product f g Source #

HFunctor (Sum f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> Sum f f0 ~> Sum f g Source #

HFunctor ((:*:) f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> (f :*: f0) ~> (f :*: g) Source #

HFunctor ((:+:) f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> (f :+: f0) ~> (f :+: g) Source #

HFunctor (Comp f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> Comp f f0 ~> Comp f g Source #

HFunctor (ProxyF :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> ProxyF f ~> ProxyF g Source #

HFunctor (MapF k2 :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> MapF k2 f ~> MapF k2 g Source #

HFunctor (NEMapF k2 :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> NEMapF k2 f ~> NEMapF k2 g Source #

HFunctor t => HFunctor (HFree t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> HFree t f ~> HFree t g Source #

HFunctor t => HFunctor (HLift t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> HLift t f ~> HLift t g Source #

HBifunctor t => HFunctor (Chain1 t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Chain1 t f ~> Chain1 t g Source #

HFunctor (Final c :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Final c f ~> Final c g Source #

HFunctor (Void2 :: (k1 -> Type) -> k2 -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Void2 f ~> Void2 g Source #

Functor f => HFunctor ((:.:) f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> (f :.: f0) ~> (f :.: g) Source #

HFunctor (M1 i c :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> M1 i c f ~> M1 i c g Source #

HBifunctor t => HFunctor (WrappedHBifunctor t f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> WrappedHBifunctor t f f0 ~> WrappedHBifunctor t f g Source #

HFunctor (LeftF f :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HBifunctor

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> LeftF f f0 ~> LeftF f g Source #

HFunctor (ConstF e :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> ConstF e f ~> ConstF e g Source #

HFunctor t => HFunctor (WrapHF t :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.Interpret

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> WrapHF t f ~> WrapHF t g Source #

HFunctor (RightF g :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HBifunctor

Methods

hmap :: forall (f :: k -> Type) (g0 :: k -> Type). (f ~> g0) -> RightF g f ~> RightF g g0 Source #

HFunctor (Joker f :: (k2 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Joker f f0 ~> Joker f g Source #

HBifunctor t => HFunctor (Chain t i :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Chain t i f ~> Chain t i g Source #

HFunctor (Void3 f :: (k2 -> Type) -> k3 -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Void3 f f0 ~> Void3 f g Source #

HBifunctor t => HFunctor (WrapHBF t f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HBifunctor.Associative

Methods

hmap :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> g) -> WrapHBF t f f0 ~> WrapHBF t f g Source #

HFunctor Alt Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Alt f ~> Alt g Source #

HFunctor AltF Source #

Since: 0.3.6.0

Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> AltF f ~> AltF g Source #

HFunctor Ap Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Ap f ~> Ap g Source #

HFunctor (NP :: (k -> Type) -> [k] -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> NP f ~> NP g Source #

HFunctor (NS :: (k -> Type) -> [k] -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> NS f ~> NS g Source #

HFunctor (CoRec :: (k -> Type) -> [k] -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> CoRec f ~> CoRec g Source #

HFunctor (Rec :: (k -> Type) -> [k] -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> Rec f ~> Rec g Source #

HFunctor (Day f :: (TYPE LiftedRep -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Internal

Methods

hmap :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> g) -> Day f f0 ~> Day f g Source #

HFunctor Div Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Div f ~> Div g Source #

HFunctor Div1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> Div1 f ~> Div1 g Source #

HFunctor DecAlt Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DecAlt f ~> DecAlt g Source #

HFunctor DecAlt1 Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DecAlt1 f ~> DecAlt1 g Source #

HFunctor DivAp Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DivAp f ~> DivAp g Source #

HFunctor DivAp1 Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> DivAp1 f ~> DivAp1 g Source #

overHFunctor :: HFunctor t => (f <~> g) -> t f <~> t g Source #

Lift an isomorphism over an HFunctor.

Essentailly, if f and g are isomorphic, then so are t f and t g.

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
Inject Alt Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Alt f Source #

Inject Ap Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Ap f Source #

Inject Ap Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Ap f Source #

Inject Ap Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Ap f Source #

Inject Free Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Free f Source #

Inject Free1 Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Free1 f Source #

Inject Ap1 Source # 
Instance details

Defined in Data.Functor.Apply.Free

Methods

inject :: forall (f :: k -> Type). f ~> Ap1 f Source #

Inject Dec Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: forall (f :: k -> Type). f ~> Dec f Source #

Inject Dec1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: forall (f :: k -> Type). f ~> Dec1 f Source #

Inject DecAlt Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

inject :: forall (f :: k -> Type). f ~> DecAlt f Source #

Inject Coyoneda Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Coyoneda f Source #

Inject Coyoneda Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Coyoneda f Source #

Inject MaybeApply Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> MaybeApply f Source #

Inject WrappedApplicative Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> WrappedApplicative f Source #

Inject Lift Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> Lift f Source #

Monoid e => Inject (EnvT e :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> EnvT e f Source #

Monoid a => Inject (Post a :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Route

Methods

inject :: forall (f :: k -> Type). f ~> Post a f Source #

Inject t => Inject (PostT t :: (Type -> Type) -> Type -> Type) Source #

Since: 0.3.4.2

Instance details

Defined in Data.HFunctor.Route

Methods

inject :: forall (f :: k -> Type). f ~> PostT t 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 details

Defined in Data.HFunctor.Route

Methods

inject :: forall (f :: k -> Type). f ~> Pre a f Source #

Inject t => Inject (PreT t :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Route

Methods

inject :: forall (f :: k -> Type). f ~> PreT t f Source #

Inject (These1 f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k -> Type). f0 ~> These1 f f0 Source #

Inject (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> ReaderT r f Source #

Inject (ListF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> ListF f Source #

Inject (MaybeF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> MaybeF f Source #

Inject (NonEmptyF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> NonEmptyF f Source #

Inject (Flagged :: (k -> Type) -> k -> Type) Source #

Injects with False.

Equivalent to instance for EnvT Any and HLift IdentityT.

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> Flagged f Source #

Inject (Step :: (k -> Type) -> k -> Type) Source #

Injects with 0.

Equivalent to instance for EnvT (Sum Natural).

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> Step f Source #

Inject (Steps :: (k -> TYPE LiftedRep) -> k -> TYPE LiftedRep) Source #

Injects into a singleton map at 0; same behavior as NEMapF (Sum Natural).

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> Steps f Source #

Inject (Backwards :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> Backwards f Source #

Inject (IdentityT :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> IdentityT f Source #

Inject (Reverse :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> Reverse f Source #

Plus f => Inject (Product f :: (Type -> Type) -> Type -> Type) Source #

Only uses zero

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k -> Type). f0 ~> Product f f0 Source #

Plus f => Inject ((:*:) f :: (Type -> Type) -> Type -> Type) Source #

Only uses zero

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k -> Type). f0 ~> (f :*: f0) Source #

Applicative f => Inject (Comp f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k -> Type). f0 ~> Comp f f0 Source #

(Inject s, Inject t) => Inject (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> ComposeT s t f Source #

Inject (Sum f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k0 -> Type). f0 ~> Sum f f0 Source #

Inject ((:+:) f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k0 -> Type). f0 ~> (f :+: f0) Source #

HFunctor t => Inject (HFree t :: (k -> Type) -> k -> Type) Source #

HFree is the "free HBind and Inject" for any HFunctor

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> HFree t f Source #

HFunctor t => Inject (HLift t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> HLift t f Source #

Inject (ProxyF :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> ProxyF f Source #

HBifunctor t => Inject (Chain1 t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

inject :: forall (f :: k0 -> Type). f ~> Chain1 t f Source #

Inject (Final c :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

inject :: forall (f :: k0 -> Type). f ~> Final c f Source #

Monoid k2 => Inject (MapF k2 :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source #

Injects into a singleton map at mempty.

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> MapF k2 f Source #

Monoid k2 => Inject (NEMapF k2 :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source #

Injects into a singleton map at mempty.

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k -> Type). f ~> NEMapF k2 f Source #

Applicative f => Inject ((:.:) f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f0 :: k0 -> Type). f0 ~> (f :.: f0) Source #

Inject (M1 i c :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> M1 i c f Source #

Monoid e => Inject (ConstF e :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> ConstF e f Source #

Inject t => Inject (WrapHF t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Interpret

Methods

inject :: forall (f :: k0 -> Type). f ~> WrapHF t f Source #

Inject (RightF g :: (k2 -> Type) -> k2 -> Type) Source # 
Instance details

Defined in Data.HBifunctor

Methods

inject :: forall (f :: k -> Type). f ~> RightF g f Source #

Tensor t i => Inject (Chain t i :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Chain

Methods

inject :: forall (f :: k -> Type). f ~> Chain t i f Source #

Inject Div Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: forall (f :: k -> Type). f ~> Div f Source #

Inject Div1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: forall (f :: k -> Type). f ~> Div1 f Source #

Inject DecAlt1 Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

inject :: forall (f :: k -> Type). f ~> DecAlt1 f Source #

Inject DivAp Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

inject :: forall (f :: k -> Type). f ~> DivAp f Source #

Inject DivAp1 Source # 
Instance details

Defined in Data.HFunctor.Chain.Internal

Methods

inject :: forall (f :: k -> Type). f ~> DivAp1 f Source #

class Inject t => HBind t where Source #

HBind is effectively a "higher-order Monad", in the sense that HFunctor is a "higher-order Functor".

It can be considered a typeclass for HFunctors that you can bind continuations to, nautraluniversal over all ffunctors. They work "for all functors" you lift, without requiring any constraints.

It is very similar to Interpret, except Interpret has the ability to constrain the contexts to some typeclass.

The main law is that binding inject should leave things unchanged:

hbind inject == id

But hbind should also be associatiatve, in a way that makes

hjoin . hjoin
   = hjoin . hmap hjoin

That is, squishing a t (t (t f)) a into a t f a can be done "inside" first, then "outside", or "outside" first, then "inside".

Note that these laws are different from the Interpret laws, so we often have instances where hbind and interpret (though they both may typecheck) produce different behavior.

This class is similar to MMonad from Control.Monad.Morph, but instances must work without a Monad constraint.

Minimal complete definition

hbind | hjoin

Methods

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

Bind a continuation to a t f into some context g.

hjoin :: t (t f) ~> t f Source #

Collapse a nested t (t f) into a single t f.

Instances

Instances details
HBind Alt Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Alt g) -> Alt f ~> Alt g Source #

hjoin :: forall (f :: k -> Type). Alt (Alt f) ~> Alt f Source #

HBind Ap Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Ap g) -> Ap f ~> Ap g Source #

hjoin :: forall (f :: k -> Type). Ap (Ap f) ~> Ap f Source #

HBind Ap Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Ap g) -> Ap f ~> Ap g Source #

hjoin :: forall (f :: k -> Type). Ap (Ap f) ~> Ap f Source #

HBind Ap Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Ap g) -> Ap f ~> Ap g Source #

hjoin :: forall (f :: k -> Type). Ap (Ap f) ~> Ap f Source #

HBind Free Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Free g) -> Free f ~> Free g Source #

hjoin :: forall (f :: k -> Type). Free (Free f) ~> Free f Source #

HBind Free1 Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Free1 g) -> Free1 f ~> Free1 g Source #

hjoin :: forall (f :: k -> Type). Free1 (Free1 f) ~> Free1 f Source #

HBind Ap1 Source # 
Instance details

Defined in Data.Functor.Apply.Free

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Ap1 g) -> Ap1 f ~> Ap1 g Source #

hjoin :: forall (f :: k -> Type). Ap1 (Ap1 f) ~> Ap1 f Source #

HBind Coyoneda Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Coyoneda g) -> Coyoneda f ~> Coyoneda g Source #

hjoin :: forall (f :: k -> Type). Coyoneda (Coyoneda f) ~> Coyoneda f Source #

HBind MaybeApply Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> MaybeApply g) -> MaybeApply f ~> MaybeApply g Source #

hjoin :: forall (f :: k -> Type). MaybeApply (MaybeApply f) ~> MaybeApply f Source #

HBind WrappedApplicative Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> WrappedApplicative g) -> WrappedApplicative f ~> WrappedApplicative g Source #

hjoin :: forall (f :: k -> Type). WrappedApplicative (WrappedApplicative f) ~> WrappedApplicative f Source #

HBind Lift Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Lift g) -> Lift f ~> Lift g Source #

hjoin :: forall (f :: k -> Type). Lift (Lift f) ~> Lift f Source #

Monoid e => HBind (EnvT e :: (Type -> Type) -> Type -> Type) Source #

Combines the accumulators, Writer-style

Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> EnvT e g) -> EnvT e f ~> EnvT e g Source #

hjoin :: forall (f :: k -> Type). EnvT e (EnvT e f) ~> EnvT e f Source #

Monoid a => HBind (Post a :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Route

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Post a g) -> Post a f ~> Post a g Source #

hjoin :: forall (f :: k -> Type). Post a (Post a f) ~> Post a f Source #

a ~ Void => HBind (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 details

Defined in Data.HFunctor.Route

Methods

hbind :: forall (f :: k -> Type) (g :: k -> Type). (f ~> Pre a g) -> Pre a f ~> Pre a g Source #

hjoin :: forall (f :: k -> Type). Pre a (Pre a f) ~> Pre a f Source #

Alt f => HBind (These1 f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> These1 f g) -> These1 f f0 ~> These1 f g Source #

hjoin :: forall (f0 :: k -> Type). These1 f (These1 f f0) ~> These1 f f0 Source #

HBind (ListF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> ListF g) -> ListF f ~> ListF g Source #

hjoin :: forall (f :: k0 -> Type). ListF (ListF f) ~> ListF f Source #

HBind (MaybeF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> MaybeF g) -> MaybeF f ~> MaybeF g Source #

hjoin :: forall (f :: k0 -> Type). MaybeF (MaybeF f) ~> MaybeF f Source #

HBind (NonEmptyF :: (k -> Type) -> k -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> NonEmptyF g) -> NonEmptyF f ~> NonEmptyF g Source #

hjoin :: forall (f :: k0 -> Type). NonEmptyF (NonEmptyF f) ~> NonEmptyF f Source #

HBind (Flagged :: (k -> Type) -> k -> Type) Source #

Equivalent to instance for EnvT Any and HLift IdentityT.

Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> Flagged g) -> Flagged f ~> Flagged g Source #

hjoin :: forall (f :: k0 -> Type). Flagged (Flagged f) ~> Flagged f Source #

HBind (Step :: (k -> Type) -> k -> Type) Source #

Equivalent to instance for EnvT (Sum Natural).

Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> Step g) -> Step f ~> Step g Source #

hjoin :: forall (f :: k0 -> Type). Step (Step f) ~> Step f Source #

HBind (Backwards :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> Backwards g) -> Backwards f ~> Backwards g Source #

hjoin :: forall (f :: k0 -> Type). Backwards (Backwards f) ~> Backwards f Source #

HBind (IdentityT :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> IdentityT g) -> IdentityT f ~> IdentityT g Source #

hjoin :: forall (f :: k0 -> Type). IdentityT (IdentityT f) ~> IdentityT f Source #

HBind (Reverse :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> Reverse g) -> Reverse f ~> Reverse g Source #

hjoin :: forall (f :: k0 -> Type). Reverse (Reverse f) ~> Reverse f Source #

Plus f => HBind (Product f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> Product f g) -> Product f f0 ~> Product f g Source #

hjoin :: forall (f0 :: k -> Type). Product f (Product f f0) ~> Product f f0 Source #

Plus f => HBind ((:*:) f :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f0 :: k -> Type) (g :: k -> Type). (f0 ~> (f :*: g)) -> (f :*: f0) ~> (f :*: g) Source #

hjoin :: forall (f0 :: k -> Type). (f :*: (f :*: f0)) ~> (f :*: f0) Source #

HBind (Sum f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> Sum f g) -> Sum f f0 ~> Sum f g Source #

hjoin :: forall (f0 :: k0 -> Type). Sum f (Sum f f0) ~> Sum f f0 Source #

HBind ((:+:) f :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f0 :: k0 -> Type) (g :: k0 -> Type). (f0 ~> (f :+: g)) -> (f :+: f0) ~> (f :+: g) Source #

hjoin :: forall (f0 :: k0 -> Type). (f :+: (f :+: f0)) ~> (f :+: f0) Source #

HFunctor t => HBind (HFree t :: (k -> Type) -> k -> Type) Source #

HFree is the "free HBind" for any HFunctor

Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> HFree t g) -> HFree t f ~> HFree t g Source #

hjoin :: forall (f :: k0 -> Type). HFree t (HFree t f) ~> HFree t f Source #

HBind t => HBind (HLift t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> HLift t g) -> HLift t f ~> HLift t g Source #

hjoin :: forall (f :: k0 -> Type). HLift t (HLift t f) ~> HLift t f Source #

HBind (ProxyF :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> ProxyF g) -> ProxyF f ~> ProxyF g Source #

hjoin :: forall (f :: k0 -> Type). ProxyF (ProxyF f) ~> ProxyF f Source #

HBind (M1 i c :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> M1 i c g) -> M1 i c f ~> M1 i c g Source #

hjoin :: forall (f :: k0 -> Type). M1 i c (M1 i c f) ~> M1 i c f Source #

HBind t => HBind (WrapHF t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Interpret

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> WrapHF t g) -> WrapHF t f ~> WrapHF t g Source #

hjoin :: forall (f :: k0 -> Type). WrapHF t (WrapHF t f) ~> WrapHF t f Source #

HBind (RightF g :: (k2 -> Type) -> k2 -> Type) Source # 
Instance details

Defined in Data.HBifunctor

Methods

hbind :: forall (f :: k -> Type) (g0 :: k -> Type). (f ~> RightF g g0) -> RightF g f ~> RightF g g0 Source #

hjoin :: forall (f :: k -> Type). RightF g (RightF g f) ~> RightF g f Source #

Simple instances

data ProxyF f a Source #

The functor combinator that forgets all structure in the input. Ignores the input structure and stores no information.

Acts like the "zero" with respect to functor combinator composition.

ComposeT ProxyF f      ~ ProxyF
ComposeT f      ProxyF ~ ProxyF

It can be injected into (losing all information), but it is impossible to ever retract or interpret it.

This is essentially ConstF ().

Constructors

ProxyF 

Instances

Instances details
HTraversable (ProxyF :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.HTraversable

Methods

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

HFunctor (ProxyF :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> ProxyF f ~> ProxyF g Source #

HBind (ProxyF :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> ProxyF g) -> ProxyF f ~> ProxyF g Source #

hjoin :: forall (f :: k0 -> Type). ProxyF (ProxyF f) ~> ProxyF f Source #

Inject (ProxyF :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> ProxyF f Source #

Foldable (ProxyF f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

fold :: Monoid m => ProxyF f m -> m #

foldMap :: Monoid m => (a -> m) -> ProxyF f a -> m #

foldMap' :: Monoid m => (a -> m) -> ProxyF f a -> m #

foldr :: (a -> b -> b) -> b -> ProxyF f a -> b #

foldr' :: (a -> b -> b) -> b -> ProxyF f a -> b #

foldl :: (b -> a -> b) -> b -> ProxyF f a -> b #

foldl' :: (b -> a -> b) -> b -> ProxyF f a -> b #

foldr1 :: (a -> a -> a) -> ProxyF f a -> a #

foldl1 :: (a -> a -> a) -> ProxyF f a -> a #

toList :: ProxyF f a -> [a] #

null :: ProxyF f a -> Bool #

length :: ProxyF f a -> Int #

elem :: Eq a => a -> ProxyF f a -> Bool #

maximum :: Ord a => ProxyF f a -> a #

minimum :: Ord a => ProxyF f a -> a #

sum :: Num a => ProxyF f a -> a #

product :: Num a => ProxyF f a -> a #

Eq1 (ProxyF f :: Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftEq :: (a -> b -> Bool) -> ProxyF f a -> ProxyF f b -> Bool #

Ord1 (ProxyF f :: Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftCompare :: (a -> b -> Ordering) -> ProxyF f a -> ProxyF f b -> Ordering #

Read1 (ProxyF f :: Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ProxyF f a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ProxyF f a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ProxyF f a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ProxyF f a] #

Show1 (ProxyF f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ProxyF f a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ProxyF f a] -> ShowS #

Contravariant (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

contramap :: (a' -> a) -> ProxyF f a -> ProxyF f a' #

(>$) :: b -> ProxyF f b -> ProxyF f a #

Traversable (ProxyF f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

traverse :: Applicative f0 => (a -> f0 b) -> ProxyF f a -> f0 (ProxyF f b) #

sequenceA :: Applicative f0 => ProxyF f (f0 a) -> f0 (ProxyF f a) #

mapM :: Monad m => (a -> m b) -> ProxyF f a -> m (ProxyF f b) #

sequence :: Monad m => ProxyF f (m a) -> m (ProxyF f a) #

Functor (ProxyF f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

fmap :: (a -> b) -> ProxyF f a -> ProxyF f b #

(<$) :: a -> ProxyF f b -> ProxyF f a #

Decidable (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

lose :: (a -> Void) -> ProxyF f a #

choose :: (a -> Either b c) -> ProxyF f b -> ProxyF f c -> ProxyF f a #

Divisible (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

divide :: (a -> (b, c)) -> ProxyF f b -> ProxyF f c -> ProxyF f a #

conquer :: ProxyF f a #

Conclude (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

conclude :: (a -> Void) -> ProxyF f a Source #

Decide (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

decide :: (a -> Either b c) -> ProxyF f b -> ProxyF f c -> ProxyF f a Source #

Divise (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

divise :: (a -> (b, c)) -> ProxyF f b -> ProxyF f c -> ProxyF f a Source #

divised :: ProxyF f a -> ProxyF f b -> ProxyF f (a, b) Source #

Invariant (ProxyF f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

invmap :: (a -> b) -> (b -> a) -> ProxyF f a -> ProxyF f b #

(Typeable f, Typeable a, Typeable k1, Typeable k2) => Data (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ProxyF f a -> c (ProxyF f a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ProxyF f a) #

toConstr :: ProxyF f a -> Constr #

dataTypeOf :: ProxyF f a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ProxyF f a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ProxyF f a)) #

gmapT :: (forall b. Data b => b -> b) -> ProxyF f a -> ProxyF f a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ProxyF f a -> r #

gmapQ :: (forall d. Data d => d -> u) -> ProxyF f a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ProxyF f a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ProxyF f a -> m (ProxyF f a) #

Generic (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

Associated Types

type Rep (ProxyF f a) :: Type -> Type #

Methods

from :: ProxyF f a -> Rep (ProxyF f a) x #

to :: Rep (ProxyF f a) x -> ProxyF f a #

Read (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

Show (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

showsPrec :: Int -> ProxyF f a -> ShowS #

show :: ProxyF f a -> String #

showList :: [ProxyF f a] -> ShowS #

Eq (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

(==) :: ProxyF f a -> ProxyF f a -> Bool #

(/=) :: ProxyF f a -> ProxyF f a -> Bool #

Ord (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

compare :: ProxyF f a -> ProxyF f a -> Ordering #

(<) :: ProxyF f a -> ProxyF f a -> Bool #

(<=) :: ProxyF f a -> ProxyF f a -> Bool #

(>) :: ProxyF f a -> ProxyF f a -> Bool #

(>=) :: ProxyF f a -> ProxyF f a -> Bool #

max :: ProxyF f a -> ProxyF f a -> ProxyF f a #

min :: ProxyF f a -> ProxyF f a -> ProxyF f a #

type Rep (ProxyF f a) Source # 
Instance details

Defined in Data.HFunctor

type Rep (ProxyF f a) = D1 ('MetaData "ProxyF" "Data.HFunctor" "functor-combinators-0.4.1.1-GvD6BEOdYqeEGstBK8j7zW" 'False) (C1 ('MetaCons "ProxyF" 'PrefixI 'False) (U1 :: Type -> Type))

data ConstF e f a Source #

Functor combinator that forgets all structure on the input, and instead stores a value of type e.

Like ProxyF, acts like a "zero" with functor combinator composition.

It can be injected into (losing all information), but it is impossible to ever retract or interpret it.

Constructors

ConstF 

Fields

Instances

Instances details
HTraversable (ConstF e :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.HTraversable

Methods

htraverse :: forall h f g (a :: k10). Applicative h => (forall (x :: k0). f x -> h (g x)) -> ConstF e f a -> h (ConstF e g a) Source #

HFunctor (ConstF e :: (k -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> g) -> ConstF e f ~> ConstF e g Source #

Monoid e => Inject (ConstF e :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> ConstF e f Source #

Foldable (ConstF e f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

fold :: Monoid m => ConstF e f m -> m #

foldMap :: Monoid m => (a -> m) -> ConstF e f a -> m #

foldMap' :: Monoid m => (a -> m) -> ConstF e f a -> m #

foldr :: (a -> b -> b) -> b -> ConstF e f a -> b #

foldr' :: (a -> b -> b) -> b -> ConstF e f a -> b #

foldl :: (b -> a -> b) -> b -> ConstF e f a -> b #

foldl' :: (b -> a -> b) -> b -> ConstF e f a -> b #

foldr1 :: (a -> a -> a) -> ConstF e f a -> a #

foldl1 :: (a -> a -> a) -> ConstF e f a -> a #

toList :: ConstF e f a -> [a] #

null :: ConstF e f a -> Bool #

length :: ConstF e f a -> Int #

elem :: Eq a => a -> ConstF e f a -> Bool #

maximum :: Ord a => ConstF e f a -> a #

minimum :: Ord a => ConstF e f a -> a #

sum :: Num a => ConstF e f a -> a #

product :: Num a => ConstF e f a -> a #

Eq e => Eq1 (ConstF e f :: Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftEq :: (a -> b -> Bool) -> ConstF e f a -> ConstF e f b -> Bool #

Ord e => Ord1 (ConstF e f :: Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftCompare :: (a -> b -> Ordering) -> ConstF e f a -> ConstF e f b -> Ordering #

Read e => Read1 (ConstF e f :: Type -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ConstF e f a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ConstF e f a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ConstF e f a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ConstF e f a] #

Show e => Show1 (ConstF e f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ConstF e f a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ConstF e f a] -> ShowS #

Contravariant (ConstF e f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

contramap :: (a' -> a) -> ConstF e f a -> ConstF e f a' #

(>$) :: b -> ConstF e f b -> ConstF e f a #

Traversable (ConstF e f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

traverse :: Applicative f0 => (a -> f0 b) -> ConstF e f a -> f0 (ConstF e f b) #

sequenceA :: Applicative f0 => ConstF e f (f0 a) -> f0 (ConstF e f a) #

mapM :: Monad m => (a -> m b) -> ConstF e f a -> m (ConstF e f b) #

sequence :: Monad m => ConstF e f (m a) -> m (ConstF e f a) #

Functor (ConstF e f :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

fmap :: (a -> b) -> ConstF e f a -> ConstF e f b #

(<$) :: a -> ConstF e f b -> ConstF e f a #

Monoid e => Divisible (ConstF e f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

divide :: (a -> (b, c)) -> ConstF e f b -> ConstF e f c -> ConstF e f a #

conquer :: ConstF e f a #

Semigroup e => Divise (ConstF e f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

divise :: (a -> (b, c)) -> ConstF e f b -> ConstF e f c -> ConstF e f a Source #

divised :: ConstF e f a -> ConstF e f b -> ConstF e f (a, b) Source #

Invariant (ConstF e f :: Type -> Type) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

invmap :: (a -> b) -> (b -> a) -> ConstF e f a -> ConstF e f b #

(Typeable f, Typeable a, Typeable k1, Typeable k2, Data e) => Data (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ConstF e f a -> c (ConstF e f a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ConstF e f a) #

toConstr :: ConstF e f a -> Constr #

dataTypeOf :: ConstF e f a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ConstF e f a)) #

dataCast2 :: Typeable t => (forall d e0. (Data d, Data e0) => c (t d e0)) -> Maybe (c (ConstF e f a)) #

gmapT :: (forall b. Data b => b -> b) -> ConstF e f a -> ConstF e f a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ConstF e f a -> r #

gmapQ :: (forall d. Data d => d -> u) -> ConstF e f a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ConstF e f a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ConstF e f a -> m (ConstF e f a) #

Generic (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

Associated Types

type Rep (ConstF e f a) :: Type -> Type #

Methods

from :: ConstF e f a -> Rep (ConstF e f a) x #

to :: Rep (ConstF e f a) x -> ConstF e f a #

Read e => Read (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

readsPrec :: Int -> ReadS (ConstF e f a) #

readList :: ReadS [ConstF e f a] #

readPrec :: ReadPrec (ConstF e f a) #

readListPrec :: ReadPrec [ConstF e f a] #

Show e => Show (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

showsPrec :: Int -> ConstF e f a -> ShowS #

show :: ConstF e f a -> String #

showList :: [ConstF e f a] -> ShowS #

Eq e => Eq (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

(==) :: ConstF e f a -> ConstF e f a -> Bool #

(/=) :: ConstF e f a -> ConstF e f a -> Bool #

Ord e => Ord (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

compare :: ConstF e f a -> ConstF e f a -> Ordering #

(<) :: ConstF e f a -> ConstF e f a -> Bool #

(<=) :: ConstF e f a -> ConstF e f a -> Bool #

(>) :: ConstF e f a -> ConstF e f a -> Bool #

(>=) :: ConstF e f a -> ConstF e f a -> Bool #

max :: ConstF e f a -> ConstF e f a -> ConstF e f a #

min :: ConstF e f a -> ConstF e f a -> ConstF e f a #

type Rep (ConstF e f a) Source # 
Instance details

Defined in Data.HFunctor

type Rep (ConstF e f a) = D1 ('MetaData "ConstF" "Data.HFunctor" "functor-combinators-0.4.1.1-GvD6BEOdYqeEGstBK8j7zW" 'False) (C1 ('MetaCons "ConstF" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConstF") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 e)))

HFunctor Combinators

data HLift t f a Source #

An "HFunctor combinator" that enhances an HFunctor with the ability to hold a single f a. This is the higher-order analogue of Lift.

You can think of it as a free Inject for any f.

Note that HLift IdentityT is equivalent to EnvT Any.

Constructors

HPure (f a) 
HOther (t f a) 

Instances

Instances details
HTraversable t => HTraversable (HLift t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.HTraversable

Methods

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

HTraversable1 t => HTraversable1 (HLift t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.HTraversable

Methods

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

HFunctor t => HFunctor (HLift t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> HLift t f ~> HLift t g Source #

HBind t => HBind (HLift t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> HLift t g) -> HLift t f ~> HLift t g Source #

hjoin :: forall (f :: k0 -> Type). HLift t (HLift t f) ~> HLift t f Source #

HFunctor t => Inject (HLift t :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> HLift t f Source #

Interpret t f => Interpret (HLift t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source #

Never uses inject

Instance details

Defined in Data.HFunctor.Interpret

Methods

retract :: HLift t f ~> f Source #

interpret :: forall (g :: k0 -> Type). (g ~> f) -> HLift t g ~> f Source #

(Eq1 (t f), Eq1 f) => Eq1 (HLift t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftEq :: (a -> b -> Bool) -> HLift t f a -> HLift t f b -> Bool #

(Ord1 (t f), Ord1 f) => Ord1 (HLift t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftCompare :: (a -> b -> Ordering) -> HLift t f a -> HLift t f b -> Ordering #

(Show1 (t f), Show1 f) => Show1 (HLift t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> HLift t f a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [HLift t f a] -> ShowS #

(Contravariant f, Contravariant (t f)) => Contravariant (HLift t f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

contramap :: (a' -> a) -> HLift t f a -> HLift t f a' #

(>$) :: b -> HLift t f b -> HLift t f a #

(Functor f, Functor (t f)) => Functor (HLift t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

fmap :: (a -> b) -> HLift t f a -> HLift t f b #

(<$) :: a -> HLift t f b -> HLift t f a #

(Invariant f, Invariant (t f)) => Invariant (HLift t f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor

Methods

invmap :: (a -> b) -> (b -> a) -> HLift t f a -> HLift t f b #

(Read (f a), Read (t f a)) => Read (HLift t f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

readsPrec :: Int -> ReadS (HLift t f a) #

readList :: ReadS [HLift t f a] #

readPrec :: ReadPrec (HLift t f a) #

readListPrec :: ReadPrec [HLift t f a] #

(Show (f a), Show (t f a)) => Show (HLift t f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

showsPrec :: Int -> HLift t f a -> ShowS #

show :: HLift t f a -> String #

showList :: [HLift t f a] -> ShowS #

(Eq (f a), Eq (t f a)) => Eq (HLift t f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

(==) :: HLift t f a -> HLift t f a -> Bool #

(/=) :: HLift t f a -> HLift t f a -> Bool #

(Ord (f a), Ord (t f a)) => Ord (HLift t f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

compare :: HLift t f a -> HLift t f a -> Ordering #

(<) :: HLift t f a -> HLift t f a -> Bool #

(<=) :: HLift t f a -> HLift t f a -> Bool #

(>) :: HLift t f a -> HLift t f a -> Bool #

(>=) :: HLift t f a -> HLift t f a -> Bool #

max :: HLift t f a -> HLift t f a -> HLift t f a #

min :: HLift t f a -> HLift t f a -> HLift t f a #

retractHLift :: Inject t => HLift t f a -> t f a Source #

A higher-level retract to get a t f a back out of an HLift t f a, provided t is an instance of Inject.

This witnesses the fact that HLift is the "Free Inject".

data HFree t f a Source #

An "HFunctor combinator" that turns an HFunctor into potentially infinite nestings of that HFunctor.

An HFree t f a is either f a, t f a, t (t f) a, t (t (t f)) a, etc.

This effectively turns t into a tree with t branches.

One particularly useful usage is with MapF. For example if you had a data type representing a command line command parser:

data Command a

You could represent "many possible named commands" using

type Commands = MapF String Command

And you can represent multiple nested named commands using:

type NestedCommands = HFree (MapF String)

This has an Interpret instance, but it can be more useful to use via direct pattern matching, or through

foldHFree
    :: HBifunctor t
    => f ~> g
    -> t g ~> g
    -> HFree t f ~> g

which requires no extra constriant on g, and lets you consider each branch separately.

This can be considered the higher-oder analogue of Free; it is the free HBind for any HFunctor t.

Note that HFree IdentityT is equivalent to Step.

Constructors

HReturn (f a) 
HJoin (t (HFree t f) a) 

Instances

Instances details
HTraversable t => HTraversable (HFree t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.HTraversable

Methods

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

HTraversable1 t => HTraversable1 (HFree t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor.HTraversable

Methods

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

HFunctor t => HFunctor (HFree t :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in Data.HFunctor

Methods

hmap :: forall (f :: k -> Type) (g :: k -> Type). (f ~> g) -> HFree t f ~> HFree t g Source #

HFunctor t => HBind (HFree t :: (k -> Type) -> k -> Type) Source #

HFree is the "free HBind" for any HFunctor

Instance details

Defined in Data.HFunctor

Methods

hbind :: forall (f :: k0 -> Type) (g :: k0 -> Type). (f ~> HFree t g) -> HFree t f ~> HFree t g Source #

hjoin :: forall (f :: k0 -> Type). HFree t (HFree t f) ~> HFree t f Source #

HFunctor t => Inject (HFree t :: (k -> Type) -> k -> Type) Source #

HFree is the "free HBind and Inject" for any HFunctor

Instance details

Defined in Data.HFunctor

Methods

inject :: forall (f :: k0 -> Type). f ~> HFree t f Source #

Interpret t f => Interpret (HFree t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source #

Never uses inject

Instance details

Defined in Data.HFunctor.Interpret

Methods

retract :: HFree t f ~> f Source #

interpret :: forall (g :: k0 -> Type). (g ~> f) -> HFree t g ~> f Source #

(Show1 (t (HFree t f)), Show1 f) => Show1 (HFree t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> HFree t f a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [HFree t f a] -> ShowS #

(Contravariant f, Contravariant (t (HFree t f))) => Contravariant (HFree t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

contramap :: (a' -> a) -> HFree t f a -> HFree t f a' #

(>$) :: b -> HFree t f b -> HFree t f a #

(Functor f, Functor (t (HFree t f))) => Functor (HFree t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

fmap :: (a -> b) -> HFree t f a -> HFree t f b #

(<$) :: a -> HFree t f b -> HFree t f a #

(Invariant f, Invariant (t (HFree t f))) => Invariant (HFree t f) Source # 
Instance details

Defined in Data.HFunctor

Methods

invmap :: (a -> b) -> (b -> a) -> HFree t f a -> HFree t f b #

(Show1 (t (HFree t f)), Show1 f, Show a) => Show (HFree t f a) Source # 
Instance details

Defined in Data.HFunctor

Methods

showsPrec :: Int -> HFree t f a -> ShowS #

show :: HFree t f a -> String #

showList :: [HFree t f a] -> ShowS #

foldHFree :: forall t f g. HFunctor t => (f ~> g) -> (t g ~> g) -> HFree t f ~> g Source #

Recursively fold down an HFree into a single g result, by handling each branch. Can be more useful than interpret because it allows you to treat each branch separately, and also does not require any constraint on g.

This is the catamorphism on HFree.

retractHFree :: HBind t => HFree t f a -> t f a Source #

A higher-level retract to get a t f a back out of an HFree t f a, provided t is an instance of Bind.

This witnesses the fact that HFree is the "Free Bind".

Utility functions

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