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

Data.HFunctor.Final

Description

Provides Final, which can be considered the "free Interpret over a constraint": generate a handy Interpret instance for any constraint c.

Synopsis

Documentation

newtype Final c f a Source #

A simple way to inject/reject into any eventual typeclass.

In a way, this is the "ultimate" multi-purpose Interpret instance. You can use this to inject an f into a free structure of any typeclass. If you want f to have a Monad instance, for example, just use

inject :: f a -> Final Monad f a

When you want to eventually interpret out the data, use:

interpret :: (f ~> g) -> Final c f a -> g a

Essentially, Final c is the "free c". Final Monad is the free Monad, etc.

Final can theoretically replace Ap, Ap1, ListF, NonEmptyF, MaybeF, Free, Identity, Coyoneda, and other instances of FreeOf, if you don't care about being able to pattern match on explicit structure.

However, it cannot replace Interpret instances that are not free structures, like Step, Steps, Backwards, etc.

Note that this doesn't have instances for all the typeclasses you could lift things into; you probably have to define your own if you want to use Final c as an instance of c (using liftFinal0, liftFinal1, liftFinal2 for help).

Constructors

Final 

Fields

  • runFinal :: forall g. c g => (forall x. f x -> g x) -> g a
     

Instances

Instances details
HFunctor (Final c :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

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

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

Defined in Data.HFunctor.Final

Methods

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

c f => Interpret (Final c :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

retract :: Final c f ~> f Source #

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

MonadReader r (Final (MonadReader r) f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

ask :: Final (MonadReader r) f r #

local :: (r -> r) -> Final (MonadReader r) f a -> Final (MonadReader r) f a #

reader :: (r -> a) -> Final (MonadReader r) f a #

Monad (Final Monad f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(>>=) :: Final Monad f a -> (a -> Final Monad f b) -> Final Monad f b #

(>>) :: Final Monad f a -> Final Monad f b -> Final Monad f b #

return :: a -> Final Monad f a #

Monad (Final (MonadReader r) f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(>>=) :: Final (MonadReader r) f a -> (a -> Final (MonadReader r) f b) -> Final (MonadReader r) f b #

(>>) :: Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f b #

return :: a -> Final (MonadReader r) f a #

Monad (Final MonadPlus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(>>=) :: Final MonadPlus f a -> (a -> Final MonadPlus f b) -> Final MonadPlus f b #

(>>) :: Final MonadPlus f a -> Final MonadPlus f b -> Final MonadPlus f b #

return :: a -> Final MonadPlus f a #

Functor (Final Monad f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Monad f a -> Final Monad f b #

(<$) :: a -> Final Monad f b -> Final Monad f a #

Functor (Final Functor f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Functor f a -> Final Functor f b #

(<$) :: a -> Final Functor f b -> Final Functor f a #

Functor (Final Applicative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Applicative f a -> Final Applicative f b #

(<$) :: a -> Final Applicative f b -> Final Applicative f a #

Functor (Final (MonadReader r) f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final (MonadReader r) f a -> Final (MonadReader r) f b #

(<$) :: a -> Final (MonadReader r) f b -> Final (MonadReader r) f a #

Functor (Final Alternative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Alternative f a -> Final Alternative f b #

(<$) :: a -> Final Alternative f b -> Final Alternative f a #

Functor (Final MonadPlus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final MonadPlus f a -> Final MonadPlus f b #

(<$) :: a -> Final MonadPlus f b -> Final MonadPlus f a #

Functor (Final Apply f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Apply f a -> Final Apply f b #

(<$) :: a -> Final Apply f b -> Final Apply f a #

Functor (Final Plus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Plus f a -> Final Plus f b #

(<$) :: a -> Final Plus f b -> Final Plus f a #

Functor (Final Alt f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Alt f a -> Final Alt f b #

(<$) :: a -> Final Alt f b -> Final Alt f a #

Functor (Final Bind f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

fmap :: (a -> b) -> Final Bind f a -> Final Bind f b #

(<$) :: a -> Final Bind f b -> Final Bind f a #

Applicative (Final Monad f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

pure :: a -> Final Monad f a #

(<*>) :: Final Monad f (a -> b) -> Final Monad f a -> Final Monad f b #

liftA2 :: (a -> b -> c) -> Final Monad f a -> Final Monad f b -> Final Monad f c #

(*>) :: Final Monad f a -> Final Monad f b -> Final Monad f b #

(<*) :: Final Monad f a -> Final Monad f b -> Final Monad f a #

Applicative (Final Applicative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

pure :: a -> Final Applicative f a #

(<*>) :: Final Applicative f (a -> b) -> Final Applicative f a -> Final Applicative f b #

liftA2 :: (a -> b -> c) -> Final Applicative f a -> Final Applicative f b -> Final Applicative f c #

(*>) :: Final Applicative f a -> Final Applicative f b -> Final Applicative f b #

(<*) :: Final Applicative f a -> Final Applicative f b -> Final Applicative f a #

Applicative (Final (MonadReader r) f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

pure :: a -> Final (MonadReader r) f a #

(<*>) :: Final (MonadReader r) f (a -> b) -> Final (MonadReader r) f a -> Final (MonadReader r) f b #

liftA2 :: (a -> b -> c) -> Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f c #

(*>) :: Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f b #

(<*) :: Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f a #

Applicative (Final Alternative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

pure :: a -> Final Alternative f a #

(<*>) :: Final Alternative f (a -> b) -> Final Alternative f a -> Final Alternative f b #

liftA2 :: (a -> b -> c) -> Final Alternative f a -> Final Alternative f b -> Final Alternative f c #

(*>) :: Final Alternative f a -> Final Alternative f b -> Final Alternative f b #

(<*) :: Final Alternative f a -> Final Alternative f b -> Final Alternative f a #

Applicative (Final MonadPlus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

pure :: a -> Final MonadPlus f a #

(<*>) :: Final MonadPlus f (a -> b) -> Final MonadPlus f a -> Final MonadPlus f b #

liftA2 :: (a -> b -> c) -> Final MonadPlus f a -> Final MonadPlus f b -> Final MonadPlus f c #

(*>) :: Final MonadPlus f a -> Final MonadPlus f b -> Final MonadPlus f b #

(<*) :: Final MonadPlus f a -> Final MonadPlus f b -> Final MonadPlus f a #

Contravariant (Final Contravariant f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

contramap :: (a -> b) -> Final Contravariant f b -> Final Contravariant f a #

(>$) :: b -> Final Contravariant f b -> Final Contravariant f a #

Contravariant (Final Divisible f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

contramap :: (a -> b) -> Final Divisible f b -> Final Divisible f a #

(>$) :: b -> Final Divisible f b -> Final Divisible f a #

Contravariant (Final Decidable f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

contramap :: (a -> b) -> Final Decidable f b -> Final Decidable f a #

(>$) :: b -> Final Decidable f b -> Final Decidable f a #

Contravariant (Final Divise f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

contramap :: (a -> b) -> Final Divise f b -> Final Divise f a #

(>$) :: b -> Final Divise f b -> Final Divise f a #

Contravariant (Final Decide f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

contramap :: (a -> b) -> Final Decide f b -> Final Decide f a #

(>$) :: b -> Final Decide f b -> Final Decide f a #

Contravariant (Final Conclude f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

contramap :: (a -> b) -> Final Conclude f b -> Final Conclude f a #

(>$) :: b -> Final Conclude f b -> Final Conclude f a #

Alternative (Final Alternative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Alternative (Final MonadPlus f) Source # 
Instance details

Defined in Data.HFunctor.Final

MonadPlus (Final MonadPlus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Divisible (Final Divisible f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

conquer :: Final Divisible f a #

Divisible (Final Decidable f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

conquer :: Final Decidable f a #

Decidable (Final Decidable f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

lose :: (a -> Void) -> Final Decidable f a #

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

Invariant (Final Invariant f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

invmap :: (a -> b) -> (b -> a) -> Final Invariant f a -> Final Invariant f b #

Apply (Final Monad f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(<.>) :: Final Monad f (a -> b) -> Final Monad f a -> Final Monad f b #

(.>) :: Final Monad f a -> Final Monad f b -> Final Monad f b #

(<.) :: Final Monad f a -> Final Monad f b -> Final Monad f a #

liftF2 :: (a -> b -> c) -> Final Monad f a -> Final Monad f b -> Final Monad f c #

Apply (Final Applicative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Apply (Final (MonadReader r) f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(<.>) :: Final (MonadReader r) f (a -> b) -> Final (MonadReader r) f a -> Final (MonadReader r) f b #

(.>) :: Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f b #

(<.) :: Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f a #

liftF2 :: (a -> b -> c) -> Final (MonadReader r) f a -> Final (MonadReader r) f b -> Final (MonadReader r) f c #

Apply (Final Alternative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Apply (Final Apply f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(<.>) :: Final Apply f (a -> b) -> Final Apply f a -> Final Apply f b #

(.>) :: Final Apply f a -> Final Apply f b -> Final Apply f b #

(<.) :: Final Apply f a -> Final Apply f b -> Final Apply f a #

liftF2 :: (a -> b -> c) -> Final Apply f a -> Final Apply f b -> Final Apply f c #

Apply (Final Bind f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(<.>) :: Final Bind f (a -> b) -> Final Bind f a -> Final Bind f b #

(.>) :: Final Bind f a -> Final Bind f b -> Final Bind f b #

(<.) :: Final Bind f a -> Final Bind f b -> Final Bind f a #

liftF2 :: (a -> b -> c) -> Final Bind f a -> Final Bind f b -> Final Bind f c #

Pointed (Final Pointed f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

point :: a -> Final Pointed f a #

Plus (Final Alternative f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

zero :: Final Alternative f a #

Plus (Final MonadPlus f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

zero :: Final MonadPlus f a #

Plus (Final Plus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

zero :: Final Plus f a #

Alt (Final Alternative f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Alt (Final MonadPlus f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Alt (Final Plus f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(<!>) :: Final Plus f a -> Final Plus f a -> Final Plus f a #

some :: Applicative (Final Plus f) => Final Plus f a -> Final Plus f [a] #

many :: Applicative (Final Plus f) => Final Plus f a -> Final Plus f [a] #

Alt (Final Alt f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(<!>) :: Final Alt f a -> Final Alt f a -> Final Alt f a #

some :: Applicative (Final Alt f) => Final Alt f a -> Final Alt f [a] #

many :: Applicative (Final Alt f) => Final Alt f a -> Final Alt f [a] #

Bind (Final Bind f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

(>>-) :: Final Bind f a -> (a -> Final Bind f b) -> Final Bind f b #

join :: Final Bind f (Final Bind f a) -> Final Bind f a #

Divise (Final Divisible f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Divise (Final Divise f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Decide (Final Decidable f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Decide (Final Decide f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Decide (Final Conclude f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Conclude (Final Decidable f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

conclude :: (a -> Void) -> Final Decidable f a Source #

Conclude (Final Conclude f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

conclude :: (a -> Void) -> Final Conclude f a Source #

fromFinal :: (Inject t, c (t f)) => Final c f ~> t f Source #

Concretize a Final.

fromFinal :: Final Functor f ~> Coyoneda f
fromFinal :: Final Applicative f ~> Ap f
fromFinal :: Final Alternative f ~> Alt f
fromFinal :: Final Monad f ~> Free f
fromFinal :: Final Pointed f ~> Lift f
fromFinal :: Final Plus f ~> ListF f

This can be useful because Final doesn't have a concrete structure that you can pattern match on and inspect, but t might.

In the case that this forms an isomorphism with toFinal, the t will have an instance of FreeOf.

toFinal :: Interpret t (Final c f) => t f ~> Final c f Source #

Finalize an Interpret instance.

toFinal :: Coyoneda f ~> Final Functor f
toFinal :: Ap f ~> Final Applicative f
toFinal :: Alt f ~> Final Alternative f
toFinal :: Free f ~> Final Monad f
toFinal :: Lift f ~> Final Pointed f
toFinal :: ListF f ~> Final Plus f

Note that the instance of c for Final c must be defined.

This operation can potentially forget structure in t. For example, we have:

toFinal :: Steps f ~> Final Alt f

In this process, we lose the "positional" structure of Steps.

In the case where toFinal doesn't lose any information, this will form an isomorphism with fromFinal, and t is known as the "Free c". For such a situation, t will have a FreeOf instance.

class FreeOf c t | t -> c where Source #

A typeclass associating a free structure with the typeclass it is free on.

This essentially lists instances of Interpret where a "trip" through Final will leave it unchanged.

fromFree . toFree == id
toFree . fromFree == id

This can be useful because Final doesn't have a concrete structure that you can pattern match on and inspect, but t might. This lets you work on a concrete structure if you desire.

Minimal complete definition

Nothing

Associated Types

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

What "type" of functor is expected: should be either Unconstrained, Functor, Contravariant, or Invariant.

Since: 0.3.0.0

Methods

fromFree :: t f ~> Final c f Source #

default fromFree :: Interpret t (Final c f) => t f ~> Final c f Source #

toFree :: FreeFunctorBy t f => Final c f ~> t f Source #

default toFree :: (Inject t, c (t f)) => Final c f ~> t f Source #

Instances

Instances details
FreeOf Monad Free Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Free :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Free f ~> Final Monad f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Free f => Final Monad f ~> Free f Source #

FreeOf Functor Coyoneda Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Coyoneda :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Coyoneda f ~> Final Functor f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Coyoneda f => Final Functor f ~> Coyoneda f Source #

FreeOf Applicative Ap Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Ap :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Ap f ~> Final Applicative f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Ap f => Final Applicative f ~> Ap f Source #

FreeOf Applicative Ap Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Ap :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Ap f ~> Final Applicative f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Ap f => Final Applicative f ~> Ap f Source #

FreeOf Contravariant Coyoneda Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Coyoneda :: (Type -> Type) -> Constraint Source #

FreeOf Alternative Alt Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Alt :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Alt f ~> Final Alternative f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Alt f => Final Alternative f ~> Alt f Source #

FreeOf Divisible Div Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Div :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Div f ~> Final Divisible f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Div f => Final Divisible f ~> Div f Source #

FreeOf Apply Ap1 Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Ap1 :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Ap1 f ~> Final Apply f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Ap1 f => Final Apply f ~> Ap1 f Source #

FreeOf Pointed MaybeApply Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy MaybeApply :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). MaybeApply f ~> Final Pointed f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy MaybeApply f => Final Pointed f ~> MaybeApply f Source #

FreeOf Pointed Lift Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Lift :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Lift f ~> Final Pointed f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Lift f => Final Pointed f ~> Lift f Source #

FreeOf Bind Free1 Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Free1 :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Free1 f ~> Final Bind f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Free1 f => Final Bind f ~> Free1 f Source #

FreeOf Divise Div1 Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Div1 :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Div1 f ~> Final Divise f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Div1 f => Final Divise f ~> Div1 f Source #

FreeOf Decide Dec1 Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Dec1 :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Dec1 f ~> Final Decide f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Dec1 f => Final Decide f ~> Dec1 f Source #

FreeOf Conclude Dec Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Dec :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). Dec f ~> Final Conclude f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy Dec f => Final Conclude f ~> Dec f Source #

FreeOf Plus (ListF :: (Type -> Type) -> Type -> Type) Source #

This could also be FreeOf Divisible if FreeFunctorBy ListF ~ Contravariant. However, there isn't really a way to express this at the moment.

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy ListF :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). ListF f ~> Final Plus f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy ListF f => Final Plus f ~> ListF f Source #

FreeOf Alt (NonEmptyF :: (Type -> Type) -> Type -> Type) Source #

This could also be FreeOf Divise if FreeFunctorBy NonEmptyF ~ Contravariant. However, there isn't really a way to express this at the moment.

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy NonEmptyF :: (Type -> Type) -> Constraint Source #

Methods

fromFree :: forall (f :: Type -> Type). NonEmptyF f ~> Final Alt f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy NonEmptyF f => Final Alt f ~> NonEmptyF f Source #

FreeOf (Unconstrained :: (Type -> Type) -> Constraint) (IdentityT :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy IdentityT :: (Type -> Type) -> Constraint Source #

finalizing :: (FreeOf c t, FreeFunctorBy t f) => t f <~> Final c f Source #

The isomorphism between a free structure and its encoding as Final.

hoistFinalC :: (forall g x. (c g => g x) -> d g => g x) -> Final c f a -> Final d f a Source #

Re-interpret the context under a Final.

liftFinal0 :: (forall g. c g => g a) -> Final c f a Source #

Lift an action into a Final.

liftFinal1 :: (forall g. c g => g a -> g b) -> Final c f a -> Final c f b Source #

Map the action in a Final.

liftFinal2 :: (forall g. c g => g a -> g b -> g d) -> Final c f a -> Final c f b -> Final c f d Source #

Merge two Final actions.