functor-combinators-0.4.1.2: 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.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 :: (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 #

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 #

c f => Interpret (Final c :: (k -> Type) -> k -> TYPE LiftedRep) (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 #

Contravariant (Final Contravariant f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

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

Contravariant (Final Decidable f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

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

Contravariant (Final Divisible f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

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

Contravariant (Final Conclude f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

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

Contravariant (Final Decide f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

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

Contravariant (Final Divise f) Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

(>$) :: b -> Final Divise f b -> Final Divise 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

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 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 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 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 #

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 #

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 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 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 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 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 (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 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 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 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 #

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 #

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 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 #

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 #

MonadPlus (Final MonadPlus f) Source # 
Instance details

Defined in Data.HFunctor.Final

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 #

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 #

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 #

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 #

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 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 #

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 #

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 #

divised :: Final Divisible f a -> Final Divisible f b -> Final Divisible f (a, b) 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 #

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

Inplicative (Final Inplicative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

knot :: a -> Final Inplicative f a Source #

Inplicative (Final Internative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

knot :: a -> Final Internative f a Source #

Inply (Final Inplicative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

gather :: (b -> c -> a) -> (a -> (b, c)) -> Final Inplicative f b -> Final Inplicative f c -> Final Inplicative f a Source #

gathered :: Final Inplicative f a -> Final Inplicative f b -> Final Inplicative f (a, b) Source #

Inply (Final Inply f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

gather :: (b -> c -> a) -> (a -> (b, c)) -> Final Inply f b -> Final Inply f c -> Final Inply f a Source #

gathered :: Final Inply f a -> Final Inply f b -> Final Inply f (a, b) Source #

Inply (Final Internative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

gather :: (b -> c -> a) -> (a -> (b, c)) -> Final Internative f b -> Final Internative f c -> Final Internative f a Source #

gathered :: Final Internative f a -> Final Internative f b -> Final Internative f (a, b) Source #

Inalt (Final Inalt f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

swerve :: (b -> a) -> (c -> a) -> (a -> Either b c) -> Final Inalt f b -> Final Inalt f c -> Final Inalt f a Source #

swerved :: Final Inalt f a -> Final Inalt f b -> Final Inalt f (Either a b) Source #

Inalt (Final Inplus f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

swerve :: (b -> a) -> (c -> a) -> (a -> Either b c) -> Final Inplus f b -> Final Inplus f c -> Final Inplus f a Source #

swerved :: Final Inplus f a -> Final Inplus f b -> Final Inplus f (Either a b) Source #

Inalt (Final Internative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

swerve :: (b -> a) -> (c -> a) -> (a -> Either b c) -> Final Internative f b -> Final Internative f c -> Final Internative f a Source #

swerved :: Final Internative f a -> Final Internative f b -> Final Internative f (Either a b) Source #

Inplus (Final Inplus f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

reject :: (a -> Void) -> Final Inplus f a Source #

Inplus (Final Internative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

reject :: (a -> Void) -> Final Internative f a Source #

Invariant (Final Inplicative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Invariant (Final Inply f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Invariant (Final Inalt f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Invariant (Final Inplus f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

Invariant (Final Internative f) Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Methods

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

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 #

Pointed (Final Pointed f) Source # 
Instance details

Defined in Data.HFunctor.Final

Methods

point :: a -> Final Pointed 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 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] #

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] #

Apply (Final Alternative f) Source # 
Instance details

Defined in Data.HFunctor.Final

Apply (Final Applicative f) Source # 
Instance details

Defined in Data.HFunctor.Final

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 (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 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 #

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 #

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 #

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 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 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 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 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 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 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 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 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 Inplicative DivAp Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

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

Methods

fromFree :: forall (f :: Type -> Type). DivAp f ~> Final Inplicative f Source #

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

FreeOf Inply DivAp1 Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

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

Methods

fromFree :: forall (f :: Type -> Type). DivAp1 f ~> Final Inply f Source #

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

FreeOf Inalt DecAlt1 Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

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

Methods

fromFree :: forall (f :: Type -> Type). DecAlt1 f ~> Final Inalt f Source #

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

FreeOf Inplus DecAlt Source #

Since: 0.4.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

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

Methods

fromFree :: forall (f :: Type -> Type). DecAlt f ~> Final Inplus f Source #

toFree :: forall (f :: Type -> Type). FreeFunctorBy DecAlt f => Final Inplus f ~> DecAlt 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 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 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 Alt (NonEmptyF :: (Type -> Type) -> Type -> TYPE LiftedRep) 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 Plus (ListF :: (Type -> Type) -> Type -> TYPE LiftedRep) 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 (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.