Copyright | (c) Justin Le 2019 |
---|---|
License | BSD3 |
Maintainer | justin@jle.im |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Functor combinators and tools (typeclasses and utiility functions) to manipulate them. This is the main "entrypoint" of the library.
Classes include:
HFunctor
andHBifunctor
, used to swap out the functors that the combinators modifyInterpret
,Associative
,Tensor
, used to inject and interpret functor values with respect to their combinators.
We have some helpful utility functions, as well, built on top of these typeclasses.
The second half of this module exports the various useful functor combinators that can modify functors to add extra functionality, or join two functors together and mix them in different ways. Use them to build your final structure by combining simpler ones in composable ways!
See https://blog.jle.im/entry/functor-combinatorpedia.html and the README for a tutorial and a rundown on each different functor combinator.
Synopsis
- type (~>) (f :: k -> Type) (g :: k -> Type) = forall (x :: k). f x -> g x
- type (<~>) f g = forall p a. Profunctor p => p (g a) (g a) -> p (f a) (f a)
- class HFunctor t where
- class HFunctor t => Inject t where
- class Inject t => Interpret t f where
- forI :: Interpret t f => t g a -> (g ~> f) -> f a
- iget :: Interpret t (AltConst b) => (forall x. f x -> b) -> t f a -> b
- icollect :: (forall m. Monoid m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> [b]
- icollect1 :: (forall m. Semigroup m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> NonEmpty b
- iapply :: Interpret t (Op b) => (forall x. f x -> x -> b) -> t f a -> a -> b
- ifanout :: (forall m. Monoid m => Interpret t (Op m)) => (forall x. f x -> x -> b) -> t f a -> a -> [b]
- ifanout1 :: (forall m. Semigroup m => Interpret t (Op m)) => (forall x. f x -> x -> b) -> t f a -> a -> NonEmpty b
- getI :: Interpret t (AltConst b) => (forall x. f x -> b) -> t f a -> b
- collectI :: (forall m. Monoid m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> [b]
- injectMap :: (Inject t, Functor f) => (a -> b) -> f a -> t f b
- injectContramap :: (Inject t, Contravariant f) => (a -> b) -> f b -> t f a
- newtype AltConst w a = AltConst {
- getAltConst :: w
- class HFunctor t => HTraversable t where
- htraverse :: Applicative h => (forall x. f x -> h (g x)) -> t f a -> h (t g a)
- hsequence :: (HTraversable t, Applicative h) => t (h :.: f) a -> h (t f a)
- hfoldMap :: (HTraversable t, Monoid m) => (forall x. f x -> m) -> t f a -> m
- htoList :: HTraversable t => (forall x. f x -> b) -> t f a -> [b]
- class HTraversable t => HTraversable1 t where
- htraverse1 :: Apply h => (forall x. f x -> h (g x)) -> t f a -> h (t g a)
- hsequence1 :: (HTraversable1 t, Apply h) => t (h :.: f) a -> h (t f a)
- hfoldMap1 :: (HTraversable1 t, Semigroup m) => (forall x. f x -> m) -> t f a -> m
- htoNonEmpty :: HTraversable1 t => (forall x. f x -> b) -> t f a -> NonEmpty b
- class HBifunctor (t :: (k -> Type) -> (k -> Type) -> k -> Type) where
- class (HBifunctor t, Inject (NonEmptyBy t)) => Associative t where
- type NonEmptyBy t :: (Type -> Type) -> Type -> Type
- type FunctorBy t :: (Type -> Type) -> Constraint
- associating :: (FunctorBy t f, FunctorBy t g, FunctorBy t h) => t f (t g h) <~> t (t f g) h
- appendNE :: t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f
- matchNE :: FunctorBy t f => NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f))
- consNE :: t f (NonEmptyBy t f) ~> NonEmptyBy t f
- toNonEmptyBy :: t f f ~> NonEmptyBy t f
- class (Associative t, FunctorBy t f) => SemigroupIn t f where
- biget :: SemigroupIn t (AltConst b) => (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b
- biapply :: SemigroupIn t (Op b) => (forall x. f x -> x -> b) -> (forall x. g x -> x -> b) -> t f g a -> a -> b
- (!*!) :: SemigroupIn t h => (f ~> h) -> (g ~> h) -> t f g ~> h
- (!+!) :: (f ~> h) -> (g ~> h) -> (f :+: g) ~> h
- (!$!) :: SemigroupIn t (AltConst b) => (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b
- class (Associative t, Inject (ListBy t)) => Tensor t i | t -> i where
- type ListBy t :: (Type -> Type) -> Type -> Type
- intro1 :: f ~> t f i
- intro2 :: g ~> t i g
- elim1 :: FunctorBy t f => t f i ~> f
- elim2 :: FunctorBy t g => t i g ~> g
- appendLB :: t (ListBy t f) (ListBy t f) ~> ListBy t f
- splitNE :: NonEmptyBy t f ~> t f (ListBy t f)
- splittingLB :: ListBy t f <~> (i :+: t f (ListBy t f))
- toListBy :: t f f ~> ListBy t f
- fromNE :: NonEmptyBy t f ~> ListBy t f
- class (Tensor t i, SemigroupIn t f) => MonoidIn t i f where
- nilLB :: forall t i f. Tensor t i => i ~> ListBy t f
- consLB :: Tensor t i => t f (ListBy t f) ~> ListBy t f
- inL :: forall t i f g. MonoidIn t i g => f ~> t f g
- inR :: forall t i f g. MonoidIn t i f => g ~> t f g
- outL :: (Tensor t Proxy, FunctorBy t f) => t f g ~> f
- outR :: (Tensor t Proxy, FunctorBy t g) => t f g ~> g
- data Coyoneda (f :: Type -> Type) a where
- newtype ListF f a = ListF {
- runListF :: [f a]
- newtype NonEmptyF f a where
- NonEmptyF {
- runNonEmptyF :: NonEmpty (f a)
- pattern ProdNonEmpty :: (f :*: ListF f) a -> NonEmptyF f a
- NonEmptyF {
- newtype MaybeF f a = MaybeF {}
- newtype MapF k f a = MapF {}
- newtype NEMapF k f a = NEMapF {}
- data Ap (f :: Type -> Type) a
- data Ap1 :: (Type -> Type) -> Type -> Type where
- data Alt (f :: Type -> Type) a
- data Free f a
- data Free1 f a
- data Lift (f :: Type -> Type) a
- data Step f a = Step {}
- newtype Steps f a = Steps {}
- data ProxyF f a = ProxyF
- data ConstF e f a = ConstF {
- getConstF :: e
- data EnvT e (w :: Type -> Type) a = EnvT e (w a)
- newtype ReaderT r (m :: Type -> Type) a = ReaderT {
- runReaderT :: r -> m a
- data Flagged f a = Flagged {
- flaggedFlag :: Bool
- flaggedVal :: f a
- newtype IdentityT (f :: k -> Type) (a :: k) = IdentityT {
- runIdentityT :: f a
- data Void2 a b
- newtype Final c f a = Final {
- runFinal :: forall g. c g => (forall x. f x -> g x) -> g a
- class FreeOf c t | t -> c where
- type FreeFunctorBy t :: (Type -> Type) -> Constraint
- fromFree :: t f ~> Final c f
- toFree :: FreeFunctorBy t f => Final c f ~> t f
- newtype ComposeT (f :: (Type -> Type) -> Type -> Type) (g :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) a = ComposeT {
- getComposeT :: f (g m) a
- data Day (f :: Type -> Type) (g :: Type -> Type) a = Day (f b) (g c) (b -> c -> a)
- data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) = (f p) :*: (g p)
- prodOutL :: (f :*: g) ~> f
- prodOutR :: (f :*: g) ~> g
- data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k)
- data V1 (p :: k)
- data These1 (f :: Type -> Type) (g :: Type -> Type) a
- data Night :: (Type -> Type) -> (Type -> Type) -> Type -> Type where
- newtype Not a = Not {}
- refuted :: Not Void
- data Comp f g a where
- newtype LeftF f g a = LeftF {
- runLeftF :: f a
- newtype RightF f g a = RightF {
- runRightF :: g a
- data HLift t f a
- data HFree t f a
- generalize :: Applicative f => Identity ~> f
- absorb :: f ~> Proxy
- dsum :: (Foldable t, Divisible f) => t (f a) -> f a
- dsum1 :: (Foldable1 t, Divise f) => t (f a) -> f a
- concludeN :: Conclude f => NP f as -> f (NS I as)
- decideN :: Decide f => NP f (a ': as) -> f (NS I (a ': as))
Classes
A lot of type signatures are stated in terms of ~>
. ~>
represents a "natural transformation" between two functors: a value of
type f
is a value of type 'f a -> g a~>
g that works for any
a@.
type (~>) (f :: k -> Type) (g :: k -> Type) = forall (x :: k). f x -> g x infixr 0 #
A natural transformation from f
to g
.
type (<~>) f g = forall p a. Profunctor p => p (g a) (g a) -> p (f a) (f a) infixr 0 Source #
The type of an isomorphism between two functors. f
means that
<~>
gf
and g
are isomorphic to each other.
We can effectively use an f <~> g
with:
viewF
:: (f <~> g) -> f a -> g areviewF
:: (f <~> g) -> g a -> a a
Use viewF
to extract the "f
to g
" function, and reviewF
to
extract the "g
to f
" function. Reviewing and viewing the same value
(or vice versa) leaves the value unchanged.
One nice thing is that we can compose isomorphisms using .
from
Prelude:
(.
) :: f <~> g
-> g <~> h
-> f <~> h
Another nice thing about this representation is that we have the
"identity" isomorphism by using id
from Prelude.
id
:: f<~>
g
As a convention, most isomorphisms have form "X-ing", where the forwards function is "ing". For example, we have:
splittingSF
::Monoidal
t =>SF
t a<~>
t f (MF
t f)splitSF
:: Monoidal t => SF t a~>
t f (MF t f)
Single Functors
Classes that deal with single-functor combinators, that enhance a single functor.
class HFunctor t where Source #
An HFunctor
can be thought of a unary "functor transformer" ---
a basic functor combinator. It takes a functor as input and returns
a functor as output.
It "enhances" a functor with extra structure (sort of like how a monad
transformer enhances a Monad
with extra structure).
As a uniform inteface, we can "swap the underlying functor" (also
sometimes called "hoisting"). This is what hmap
does: it lets us swap
out the f
in a t f
for a t g
.
For example, the free monad Free
takes a Functor
and returns a new
Functor
. In the process, it provides a monadic structure over f
.
hmap
lets us turn a
into a Free
f
: a monad built over
Free
gf
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.
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,
is essentially a list of ListF
f af a
s. If we
hmap
to swap out the f a
s for g a
s, 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
is a way of formalizing this property.hmap
id
== id
Instances
class HFunctor t => Inject t where Source #
A typeclass for HFunctor
s 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
.
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
class Inject t => Interpret t f where Source #
An Interpret
lets us move in and out of the "enhanced" Functor
(t
f
) and the functor it enhances (f
). An instance
means we have Interpret
t ft f a -> f a
.
For example,
is Free
ff
enhanced with monadic structure. We get:
inject
:: f a ->Free
f ainterpret
::Monad
m => (forall x. f x -> m x) ->Free
f a -> m a
inject
will let us use our f
inside the enhanced
.
Free
finterpret
will let us "extract" the f
from a
if
we can give an interpreting function that interprets Free
ff
into some
target Monad
.
We enforce that:
interpret
id .inject
== id -- orretract
.inject
== id
That is, if we lift a value into our structure, then immediately interpret it out as itself, it should lave the value unchanged.
Note that instances of this class are intended to be written with t
as a fixed type constructor, and f
to be allowed to vary freely:
instance Monad f => Interpret Free f
Any other sort of instance and it's easy to run into problems with type
inference. If you want to write an instance that's "polymorphic" on
tensor choice, use the WrapHF
newtype wrapper over a type variable,
where the second argument also uses a type constructor:
instance Interpret (WrapHF t) (MyFunctor t)
This will prevent problems with overloaded instances.
Remove the f
out of the enhanced t f
structure, provided that
f
satisfies the necessary constraints. If it doesn't, it needs to
be properly interpret
ed out.
interpret :: (g ~> f) -> t g ~> f Source #
Given an "interpeting function" from f
to g
, interpret the f
out of the t f
into a final context g
.
Instances
Alternative f => Interpret Alt (f :: Type -> Type) Source # | A free |
Applicative f => Interpret Ap (f :: Type -> Type) Source # | A free |
Applicative f => Interpret Ap (f :: Type -> Type) Source # | A free |
Applicative f => Interpret Ap (f :: Type -> Type) Source # | A free |
Monad f => Interpret Free (f :: Type -> Type) Source # | A free |
Bind f => Interpret Free1 (f :: Type -> Type) Source # | A free |
Apply f => Interpret Ap1 (f :: Type -> Type) Source # | |
Conclude f => Interpret Dec (f :: Type -> Type) Source # | |
Decide f => Interpret Dec1 (f :: Type -> Type) Source # | |
Divisible f => Interpret Div (f :: Type -> Type) Source # | |
Divise f => Interpret Div1 (f :: Type -> Type) Source # | |
Inplus f => Interpret DecAlt (f :: Type -> TYPE LiftedRep) Source # | A free |
Inalt f => Interpret DecAlt1 (f :: Type -> TYPE LiftedRep) Source # | A free |
Contravariant f => Interpret Coyoneda (f :: Type -> Type) Source # | A free Since: 0.3.0.0 |
Functor f => Interpret Coyoneda (f :: Type -> Type) Source # | A free |
Pointed f => Interpret MaybeApply (f :: Type -> Type) Source # | A free |
Defined in Data.HFunctor.Interpret | |
Interpret WrappedApplicative (f :: Type -> Type) Source # | |
Defined in Data.HFunctor.Interpret | |
Pointed f => Interpret Lift (f :: Type -> Type) Source # | A free |
Monoid e => Interpret (EnvT e :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Plus f => Interpret (ListF :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | A free |
Plus f => Interpret (MaybeF :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | Technically, |
Alt f => Interpret (NonEmptyF :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | A free |
Alt f => Interpret (Steps :: (Type -> TYPE LiftedRep) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
Monoid a => Interpret (Post a :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Interpret t f => Interpret (PostT t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | Since: 0.3.4.2 |
a ~ Void => Interpret (Pre a :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Interpret t f => Interpret (PreT t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Plus f => Interpret (These1 g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | Technically, |
MonadReader r f => Interpret (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | A free |
Interpret (Flagged :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Interpret (Step :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Interpret (Backwards :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Interpret (IdentityT :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Interpret (Reverse :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Plus g => Interpret (Product g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Plus f => Interpret (Sum g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | Technically, |
Plus g => Interpret ((:*:) g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Plus f => Interpret ((:+:) g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | Technically, |
(Monoid k, Plus f) => Interpret (MapF k :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
(Monoid k, Alt f) => Interpret (NEMapF k :: (Type -> TYPE LiftedRep) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
SemigroupIn t f => Interpret (Chain1 t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
(Interpret s f, Interpret t f) => Interpret (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
Interpret t f => Interpret (HFree t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | Never uses |
Interpret t f => Interpret (HLift t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | Never uses |
c f => Interpret (Final c :: (k -> Type) -> k -> TYPE LiftedRep) (f :: k -> Type) Source # | |
Interpret (M1 i c :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Interpret (RightF g :: (k2 -> Type) -> k2 -> Type) (f :: k2 -> Type) Source # | |
MonoidIn t i f => Interpret (Chain t i :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | We can collapse and interpret an |
Inplicative f => Interpret DivAp (f :: Type -> TYPE LiftedRep) Source # | A free |
Inply f => Interpret DivAp1 (f :: Type -> TYPE LiftedRep) Source # | A free |
forI :: Interpret t f => t g a -> (g ~> f) -> f a Source #
A convenient flipped version of interpret
.
iget :: Interpret t (AltConst b) => (forall x. f x -> b) -> t f a -> b Source #
Useful wrapper over interpret
to allow you to directly extract
a value b
out of the t f a
, if you can convert f x
into b
.
Note that depending on the constraints on f
in
, you
may have extra constraints on Interpret
t fb
.
- If
f
is unconstrained, there are no constraints onb
- If
f
must beApply
,Alt
,Divise
, orDecide
,b
needs to be an instance ofSemigroup
. - If
f
isApplicative
,Plus
,Divisible
, orConclude
,b
needs to be an instance ofMonoid
For some constraints (like Monad
), this will not be usable.
-- get the length of theMap String
in theStep
.icollect
length :: Step (Map String) Bool -> Int
Note that in many cases, you can also use
hfoldMap
and
hfoldMap1
.
Since: 0.3.1.0
icollect :: (forall m. Monoid m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> [b] Source #
Useful wrapper over iget
to allow you to collect a b
from all
instances of f
inside a t f a
.
Will work if there is an instance of
if Interpret
t (AltConst
m)
, which will be the case if the constraint on the target
functor is Monoid
mFunctor
, Apply
, Applicative
, Alt
, Plus
,
Decide
, Divisible
, Decide
,
Conclude
, or unconstrained.
-- get the lengths of allMap String
s in theAp
.icollect
length :: Ap (Map String) Bool -> [Int]
Note that in many cases, you can also use
htoList
.
Since: 0.3.1.0
icollect1 :: (forall m. Semigroup m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> NonEmpty b Source #
Useful wrapper over iget
to allow you to collect a b
from all
instances of f
inside a t f a
, into a non-empty collection of b
s.
Will work if there is an instance of
if
Interpret
t (AltConst
m)
, which will be the case if the constraint on the target
functor is Semigroup
mFunctor
, Apply
, Alt
, Divise
, Decide
, or
unconstrained.
-- get the lengths of allMap String
s in theAp
.icollect1
length :: Ap1 (Map String) Bool ->NonEmpty
Int
Note that in many cases, you can also use
htoNonEmpty
.
Since: 0.3.1.0
iapply :: Interpret t (Op b) => (forall x. f x -> x -> b) -> t f a -> a -> b Source #
Useful wrapper over interpret
to allow you to directly consume
a value of type a
with a t f a
to create a b
. Do this by
supplying the method by which each component f x
can consume an x
.
This works for contravariant functor combinators, where t f a
can be
interpreted as a consumer of a
s.
Note that depending on the constraints on f
in
, you
may have extra constraints on Interpret
t fb
.
- If
f
is unconstrained,Decide
, orConclude
, there are no constraints onb
. This will be the case for combinators like contravariantCoyoneda
,Dec
,Dec1
. - If
f
must beDivise
,b
needs to be an instance ofSemigroup
. This will be the case for combinators likeDiv1
. - If
f
isDivisible
,b
needs to be an instance ofMonoid
. This will be the case for combinators likeDiv
.
For any Functor
or Invariant
constraint, this is not usable.
Since: 0.3.2.0
ifanout :: (forall m. Monoid m => Interpret t (Op m)) => (forall x. f x -> x -> b) -> t f a -> a -> [b] Source #
Useful wrapper over interpret
to allow you to directly consume
a value of type a
with a t f a
to create a b
, and create a list of
all the b
s created by all the f
s. Do this by supplying the method
by which each component f x
can consume an x
. This works for
contravariant functor combinators, where t f a
can be interpreted as
a consumer of a
s.
Will work if there is an instance of
if Interpret
t (Op
m)
, which will be the case if the constraint on the target
functor is Monoid
mContravariant
, Decide
, Conclude
, Divise
, Divisible
,
or unconstrained.
Note that this is really only useful outside of iapply
for Div
and
Div1
, where a
which is a collection of many different Div
ff
s
consuming types of different values. You can use this with Dec
and
Dec1
and the contravarient Coyoneda
as well, but those would
always just give you a singleton list, so you might as well use
iapply
. This is really only here for completion alongside icollect
,
or if you define your own custom functor combinators.
ifanout1 :: (forall m. Semigroup m => Interpret t (Op m)) => (forall x. f x -> x -> b) -> t f a -> a -> NonEmpty b Source #
Useful wrapper over interpret
to allow you to directly consume
a value of type a
with a t f a
to create a b
, and create a list of
all the b
s created by all the f
s. Do this by supplying the method
by which each component f x
can consume an x
. This works for
contravariant functor combinators, where t f a
can be interpreted as
a consumer of a
s.
Will work if there is an instance of
if Interpret
t (Op
m)
, which will be the case if the constraint on the target
functor is Monoid
mContravariant
, Decide
, Divise
, or unconstrained.
Note that this is really only useful outside of iapply
and ifanout
for Div1
, where a
which is a collection of many different
Div1
ff
s consuming types of different values. You can use this with Dec
and Dec1
and the contravarient Coyoneda
as well, but those would
always just give you a singleton list, so you might as well use
iapply
. This is really only here for completion alongside
icollect1
, or if you define your own custom functor combinators.
getI :: Interpret t (AltConst b) => (forall x. f x -> b) -> t f a -> b Source #
Deprecated: Use iget instead
(Deprecated) Old name for getI
; will be removed in a future
version.
collectI :: (forall m. Monoid m => Interpret t (AltConst m)) => (forall x. f x -> b) -> t f a -> [b] Source #
Deprecated: Use icollect instead
(Deprecated) Old name for icollect
; will be removed in a future
version.
injectMap :: (Inject t, Functor f) => (a -> b) -> f a -> t f b Source #
A useful wrapper over the common pattern of fmap-before-inject/inject-and-fmap.
Since: 0.3.3.0
injectContramap :: (Inject t, Contravariant f) => (a -> b) -> f b -> t f a Source #
A useful wrapper over the common pattern of contramap-before-inject/inject-and-contramap.
Since: 0.3.3.0
A version of Const
that supports Alt
, Plus
, Decide
, and
Conclude
instances. It does this
by avoiding having an Alternative
or Decidable
instance, which
causes all sorts of problems with the interactions between
Alternative
/Applicative
and
Decidable
/Divisible
.
Since: 0.3.1.0
AltConst | |
|
Instances
Foldable (AltConst w :: TYPE LiftedRep -> Type) Source # | |
Defined in Data.HFunctor.Interpret fold :: Monoid m => AltConst w m -> m # foldMap :: Monoid m => (a -> m) -> AltConst w a -> m # foldMap' :: Monoid m => (a -> m) -> AltConst w a -> m # foldr :: (a -> b -> b) -> b -> AltConst w a -> b # foldr' :: (a -> b -> b) -> b -> AltConst w a -> b # foldl :: (b -> a -> b) -> b -> AltConst w a -> b # foldl' :: (b -> a -> b) -> b -> AltConst w a -> b # foldr1 :: (a -> a -> a) -> AltConst w a -> a # foldl1 :: (a -> a -> a) -> AltConst w a -> a # toList :: AltConst w a -> [a] # null :: AltConst w a -> Bool # length :: AltConst w a -> Int # elem :: Eq a => a -> AltConst w a -> Bool # maximum :: Ord a => AltConst w a -> a # minimum :: Ord a => AltConst w a -> a # | |
Eq w => Eq1 (AltConst w :: Type -> Type) Source # | |
Ord w => Ord1 (AltConst w :: Type -> Type) Source # | |
Defined in Data.HFunctor.Interpret | |
Show w => Show1 (AltConst w :: TYPE LiftedRep -> Type) Source # | |
Contravariant (AltConst w :: Type -> Type) Source # | |
Traversable (AltConst w :: TYPE LiftedRep -> Type) Source # | |
Defined in Data.HFunctor.Interpret | |
Monoid w => Applicative (AltConst w :: Type -> Type) Source # | |
Defined in Data.HFunctor.Interpret | |
Functor (AltConst w :: TYPE LiftedRep -> Type) Source # | |
Monoid w => Divisible (AltConst w :: Type -> Type) Source # | |
Monoid w => Conclude (AltConst w :: Type -> Type) Source # | Unlike for |
Semigroup w => Decide (AltConst w :: Type -> Type) Source # | Unlike for |
Semigroup w => Divise (AltConst w :: Type -> Type) Source # | |
Invariant (AltConst w :: Type -> Type) Source # | |
Defined in Data.HFunctor.Interpret | |
Semigroup w => Alt (AltConst w :: Type -> Type) Source # | Unlike for |
Semigroup w => Apply (AltConst w :: Type -> Type) Source # | |
Monoid w => Plus (AltConst w :: Type -> Type) Source # | Unlike for |
Defined in Data.HFunctor.Interpret | |
(Typeable a, Typeable k, Data w) => Data (AltConst w a) Source # | |
Defined in Data.HFunctor.Interpret gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AltConst w a -> c (AltConst w a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (AltConst w a) # toConstr :: AltConst w a -> Constr # dataTypeOf :: AltConst w a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (AltConst w a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (AltConst w a)) # gmapT :: (forall b. Data b => b -> b) -> AltConst w a -> AltConst w a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AltConst w a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AltConst w a -> r # gmapQ :: (forall d. Data d => d -> u) -> AltConst w a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AltConst w a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AltConst w a -> m (AltConst w a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AltConst w a -> m (AltConst w a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AltConst w a -> m (AltConst w a) # | |
Generic (AltConst w a) Source # | |
Show w => Show (AltConst w a) Source # | |
Eq w => Eq (AltConst w a) Source # | |
Ord w => Ord (AltConst w a) Source # | |
Defined in Data.HFunctor.Interpret | |
type Rep (AltConst w a) Source # | |
Defined in Data.HFunctor.Interpret |
HTraversable
class HFunctor t => HTraversable t where Source #
A higher-kinded version of Traversable
, in the same way that
HFunctor
is the higher-kinded version of Functor
. Gives you an
"effectful" hmap
, in the same way that traverse
gives you an
effectful fmap
.
The typical analogues of Traversable
laws apply.
Since: 0.3.6.0
htraverse :: Applicative h => (forall x. f x -> h (g x)) -> t f a -> h (t g a) Source #
Instances
hsequence :: (HTraversable t, Applicative h) => t (h :.: f) a -> h (t f a) Source #
A wrapper over a common pattern of "inverting" layers of a functor combinator.
Since: 0.3.6.0
hfoldMap :: (HTraversable t, Monoid m) => (forall x. f x -> m) -> t f a -> m Source #
Collect all the f x
s inside a t f a
into a monoidal result using
a projecting function.
See iget
.
Since: 0.3.6.0
htoList :: HTraversable t => (forall x. f x -> b) -> t f a -> [b] Source #
Collect all the f x
s inside a t f a
into a list, using
a projecting function.
See icollect
.
Since: 0.3.6.0
class HTraversable t => HTraversable1 t where Source #
A higher-kinded version of Traversable1
, in the same way that
HFunctor
is the higher-kinded version of Functor
. Gives you an
"effectful" hmap
, in the same way that traverse1
gives you an
effectful fmap
, guaranteeing at least one item.
The typical analogues of Traversable1
laws apply.
Since: 0.3.6.0
htraverse1 :: Apply h => (forall x. f x -> h (g x)) -> t f a -> h (t g a) Source #
Instances
hsequence1 :: (HTraversable1 t, Apply h) => t (h :.: f) a -> h (t f a) Source #
A wrapper over a common pattern of "inverting" layers of a functor
combinator that always contains at least one f
item.
Since: 0.3.6.0
hfoldMap1 :: (HTraversable1 t, Semigroup m) => (forall x. f x -> m) -> t f a -> m Source #
Collect all the f x
s inside a t f a
into a semigroupoidal result
using a projecting function.
See iget
.
Since: 0.3.6.0
htoNonEmpty :: HTraversable1 t => (forall x. f x -> b) -> t f a -> NonEmpty b Source #
Collect all the f x
s inside a t f a
into a non-empty list, using
a projecting function.
See icollect1
.
Since: 0.3.6.0
Multi-Functors
Classes that deal with two-functor combinators, that "mix" two functors together in some way.
class HBifunctor (t :: (k -> Type) -> (k -> Type) -> k -> Type) where Source #
A HBifunctor
is like an HFunctor
, but it enhances two different
functors instead of just one.
Usually, it enhaces them "together" in some sort of combining way.
This typeclass provides a uniform instance for "swapping out" or
"hoisting" the enhanced functors. We can hoist the first one with
hleft
, the second one with hright
, or both at the same time with
hbimap
.
For example, the f :*: g
type gives us "both f
and g
":
data (f :*:
g) a = f a :*: g a
It combines both f
and g
into a unified structure --- here, it does
it by providing both f
and g
.
The single law is:
hbimap
id
id == id
This ensures that hleft
, hright
, and hbimap
do not affect the
structure that t
adds on top of the underlying functors.
hleft :: (f ~> j) -> t f g ~> t j g Source #
Swap out the first transformed functor.
hright :: (g ~> l) -> t f g ~> t f l Source #
Swap out the second transformed functor.
hbimap :: (f ~> j) -> (g ~> l) -> t f g ~> t j l Source #
Swap out both transformed functors at the same time.
Instances
HBifunctor Night Source # | Since: 0.3.0.0 |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Night f g ~> Night j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Night f g ~> Night f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Night f g ~> Night j l Source # | |
HBifunctor Night Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Night f g ~> Night j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Night f g ~> Night f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Night f g ~> Night j l Source # | |
HBifunctor Day Source # | Since: 0.3.0.0 |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Day f g ~> Day j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Day f g ~> Day f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Day f g ~> Day j l Source # | |
HBifunctor Day Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Day f g ~> Day j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Day f g ~> Day f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Day f g ~> Day j l Source # | |
HBifunctor These1 Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> These1 f g ~> These1 j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> These1 f g ~> These1 f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> These1 f g ~> These1 j l Source # | |
HBifunctor (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Comp f g ~> Comp j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Comp f g ~> Comp f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Comp f g ~> Comp j l Source # | |
HBifunctor (Product :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Product f g ~> Product j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Product f g ~> Product f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Product f g ~> Product j l Source # | |
HBifunctor (Sum :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Sum f g ~> Sum j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Sum f g ~> Sum f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Sum f g ~> Sum j l Source # | |
HBifunctor ((:*:) :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> (f :*: g) ~> (j :*: g) Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> (f :*: g) ~> (f :*: l) Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> (f :*: g) ~> (j :*: l) Source # | |
HBifunctor ((:+:) :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> (f :+: g) ~> (j :+: g) Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> (f :+: g) ~> (f :+: l) Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> (f :+: g) ~> (j :+: l) Source # | |
HBifunctor (Joker :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Joker f g ~> Joker j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Joker f g ~> Joker f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Joker f g ~> Joker j l Source # | |
HBifunctor (LeftF :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HBifunctor hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> LeftF f g ~> LeftF j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> LeftF f g ~> LeftF f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> LeftF f g ~> LeftF j l Source # | |
HBifunctor (RightF :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HBifunctor hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> RightF f g ~> RightF j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> RightF f g ~> RightF f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> RightF f g ~> RightF j l Source # | |
HBifunctor (Void3 :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> Void3 f g ~> Void3 j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> Void3 f g ~> Void3 f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> Void3 f g ~> Void3 j l Source # | |
HBifunctor t => HBifunctor (WrapHBF t :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HBifunctor.Associative hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> WrapHBF t f g ~> WrapHBF t j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> WrapHBF t f g ~> WrapHBF t f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> WrapHBF t f g ~> WrapHBF t j l Source # | |
HBifunctor Day Source # | Since: 0.3.4.0 |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Day f g ~> Day j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Day f g ~> Day f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Day f g ~> Day j l Source # |
Associative
class (HBifunctor t, Inject (NonEmptyBy t)) => Associative t where Source #
An HBifunctor
where it doesn't matter which binds first is
Associative
. Knowing this gives us a lot of power to rearrange the
internals of our HFunctor
at will.
For example, for the functor product:
data (f :*:
g) a = f a :*: g a
We know that f :*: (g :*: h)
is the same as (f :*: g) :*: h
.
Formally, we can say that t
enriches a the category of
endofunctors with semigroup strcture: it turns our endofunctor category
into a "semigroupoidal category".
Different instances of t
each enrich the endofunctor category in
different ways, giving a different semigroupoidal category.
type NonEmptyBy t :: (Type -> Type) -> Type -> Type Source #
The "semigroup functor combinator" generated by t
.
A value of type NonEmptyBy t f a
is equivalent to one of:
f a
t f f a
t f (t f f) a
t f (t f (t f f)) a
t f (t f (t f (t f f))) a
- .. etc
For example, for :*:
, we have NonEmptyF
. This is because:
x ~NonEmptyF
(x:|
[]) ~inject
x x:*:
y ~ NonEmptyF (x :| [y]) ~toNonEmptyBy
(x :*: y) x :*: y :*: z ~ NonEmptyF (x :| [y,z]) -- etc.
You can create an "singleton" one with inject
, or else one from
a single t f f
with toNonEmptyBy
.
See ListBy
for a "possibly empty" version
of this type.
type FunctorBy t :: (Type -> Type) -> Constraint Source #
A description of "what type of Functor" this tensor is expected to
be applied to. This should typically always be either Functor
,
Contravariant
, or Invariant
.
Since: 0.3.0.0
type FunctorBy t = Unconstrained
associating :: (FunctorBy t f, FunctorBy t g, FunctorBy t h) => t f (t g h) <~> t (t f g) h Source #
The isomorphism between t f (t g h) a
and t (t f g) h a
. To
use this isomorphism, see assoc
and disassoc
.
appendNE :: t (NonEmptyBy t f) (NonEmptyBy t f) ~> NonEmptyBy t f Source #
If a
represents multiple applications of NonEmptyBy
t ft f
to
itself, then we can also "append" two
s applied to
themselves into one giant NonEmptyBy
t f
containing all of the NonEmptyBy
t ft f
s.
Note that this essentially gives an instance for
, for any functor SemigroupIn
t (NonEmptyBy t f)f
.
matchNE :: FunctorBy t f => NonEmptyBy t f ~> (f :+: t f (NonEmptyBy t f)) Source #
If a
represents multiple applications of NonEmptyBy
t ft f
to itself, then we can split it based on whether or not it is just
a single f
or at least one top-level application of t f
.
Note that you can recursively "unroll" a NonEmptyBy
completely
into a Chain1
by using
unrollNE
.
consNE :: t f (NonEmptyBy t f) ~> NonEmptyBy t f Source #
Prepend an application of t f
to the front of a
.NonEmptyBy
t f
toNonEmptyBy :: t f f ~> NonEmptyBy t f Source #
Embed a direct application of f
to itself into a
.NonEmptyBy
t f
Instances
class (Associative t, FunctorBy t f) => SemigroupIn t f where Source #
For different
, we have functors Associative
tf
that we can
"squash", using biretract
:
t f f ~> f
This gives us the ability to squash applications of t
.
Formally, if we have
, we are enriching the category of
endofunctors with semigroup structure, turning it into a semigroupoidal
category. Different choices of Associative
tt
give different semigroupoidal
categories.
A functor f
is known as a "semigroup in the (semigroupoidal) category
of endofunctors on t
" if we can biretract
:
t f f ~> f
This gives us a few interesting results in category theory, which you can stil reading about if you don't care:
- All functors are semigroups in the semigroupoidal category
on
:+:
- The class of functors that are semigroups in the semigroupoidal
category on
:*:
is exactly the functors that are instances ofAlt
. - The class of functors that are semigroups in the semigroupoidal
category on
Day
is exactly the functors that are instances ofApply
. - The class of functors that are semigroups in the semigroupoidal
category on
Comp
is exactly the functors that are instances ofBind
.
Note that instances of this class are intended to be written with t
as a fixed type constructor, and f
to be allowed to vary freely:
instance Bind f => SemigroupIn Comp f
Any other sort of instance and it's easy to run into problems with type
inference. If you want to write an instance that's "polymorphic" on
tensor choice, use the WrapHBF
newtype wrapper over a type variable,
where the second argument also uses a type constructor:
instance SemigroupIn (WrapHBF t) (MyFunctor t i)
This will prevent problems with overloaded instances.
Nothing
biretract :: t f f ~> f Source #
The HBifunctor
analogy of retract
. It retracts both f
s
into a single f
, effectively fully mixing them together.
This function makes f
a semigroup in the category of endofunctors
with respect to tensor t
.
binterpret :: (g ~> f) -> (h ~> f) -> t g h ~> f Source #
The HBifunctor
analogy of interpret
. It takes two
interpreting functions, and mixes them together into a target
functor h
.
Note that this is useful in the poly-kinded case, but it is not possible
to define generically for all SemigroupIn
because it only is defined
for Type -> Type
inputes. See !+!
for a version that is poly-kinded
for :+:
in specific.
default binterpret :: Interpret (NonEmptyBy t) f => (g ~> f) -> (h ~> f) -> t g h ~> f Source #
Instances
Decide f => SemigroupIn Night f Source # | Since: 0.3.0.0 |
Inalt f => SemigroupIn Night f Source # | Since: 0.4.0.0 |
Divise f => SemigroupIn Day f Source # | Since: 0.3.0.0 |
Apply f => SemigroupIn Day f Source # | Instances of |
Inply f => SemigroupIn Day f Source # | Since: 0.4.0.0 |
Alt f => SemigroupIn These1 f Source # | |
Alt f => SemigroupIn (Product :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | Instances of |
SemigroupIn (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | All functors are semigroups in the semigroupoidal category on |
Alt f => SemigroupIn ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | Instances of |
SemigroupIn ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | All functors are semigroups in the semigroupoidal category on |
Bind f => SemigroupIn (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | Instances of |
SemigroupIn (Joker :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | |
SemigroupIn (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | |
SemigroupIn (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | |
SemigroupIn (Void3 :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | All functors are semigroups in the semigroupoidal category on |
(Associative t, FunctorBy t f, FunctorBy t (WrapNE t f)) => SemigroupIn (WrapHBF t) (WrapNE t f) Source # | |
(Tensor t i, FunctorBy t f, FunctorBy t (WrapLB t f)) => SemigroupIn (WrapHBF t) (WrapLB t f) Source # | |
(Associative t, FunctorBy t f, FunctorBy t (Chain1 t f)) => SemigroupIn (WrapHBF t) (Chain1 t f) Source # |
|
(Tensor t i, FunctorBy t (Chain t i f)) => SemigroupIn (WrapHBF t) (Chain t i f) Source # | We have to wrap |
biget :: SemigroupIn t (AltConst b) => (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b Source #
Useful wrapper over binterpret
to allow you to directly extract
a value b
out of the t f g a
, if you can convert an f x
and g x
into b
.
Note that depending on the constraints on h
in
,
you may have extra constraints on SemigroupIn
t hb
.
- If
h
is unconstrained, there are no constraints onb
- If
h
must beApply
,Alt
,Divise
, orDecide
,b
needs to be an instance ofSemigroup
- If
h
isApplicative
,Plus
,Divisible
, orConclude
,b
needs to be an instance ofMonoid
For some constraints (like Monad
), this will not be usable.
-- Return the length of either the list, or the Map, depending on which -- one s in the+
biget
length
length :: ([] :+:Map
Int
)Char
-> Int -- Return the length of both the list and the map, added togetherbiget
(Sum
. length) (Sum . length) ::Day
[] (Map Int) Char -> Sum Int
biapply :: SemigroupIn t (Op b) => (forall x. f x -> x -> b) -> (forall x. g x -> x -> b) -> t f g a -> a -> b Source #
Useful wrapper over binterpret
to allow you to directly extract
a value b
out of the t f g a
, if you can convert an f x
and g x
into b
, given an x
input.
Note that depending on the constraints on h
in
,
you may have extra constraints on SemigroupIn
t hb
.
- If
h
is unconstrained, there are no constraints onb
- If
h
must beDivise
, orDivisible
,b
needs to be an instance ofSemigroup
- If
h
must beDivisible
, thenb
needs to be an instance ofMonoid
.
For some constraints (like Monad
), this will not be usable.
Since: 0.3.2.0
(!*!) :: SemigroupIn t h => (f ~> h) -> (g ~> h) -> t f g ~> h infixr 5 Source #
Infix alias for binterpret
Note that this is useful in the poly-kinded case, but it is not possible
to define generically for all SemigroupIn
because it only is defined
for Type -> Type
inputes. See !+!
for a version that is poly-kinded
for :+:
in specific.
(!$!) :: SemigroupIn t (AltConst b) => (forall x. f x -> b) -> (forall x. g x -> b) -> t f g a -> b infixr 5 Source #
Tensor
class (Associative t, Inject (ListBy t)) => Tensor t i | t -> i where Source #
An Associative
HBifunctor
can be a Tensor
if there is some
identity i
where t i f
and t f i
are equivalent to just f
.
That is, "enhancing" f
with t i
does nothing.
The methods in this class provide us useful ways of navigating
a
with respect to this property.Tensor
t
The Tensor
is essentially the HBifunctor
equivalent of Inject
,
with intro1
and intro2
taking the place of inject
.
Formally, we can say that t
enriches a the category of
endofunctors with monoid strcture: it turns our endofunctor category
into a "monoidal category".
Different instances of t
each enrich the endofunctor category in
different ways, giving a different monoidal category.
type ListBy t :: (Type -> Type) -> Type -> Type Source #
The "monoidal functor combinator" induced by t
.
A value of type ListBy t f a
is equivalent to one of:
I a
-- zero fsf a
-- one ft f f a
-- two fst f (t f f) a
-- three fst f (t f (t f f)) a
t f (t f (t f (t f f))) a
- .. etc
For example, for :*:
, we have ListF
. This is because:
Proxy
~ListF
[] ~nilLB
@(:*:
) x ~ ListF [x] ~inject
x x :*: y ~ ListF [x,y] ~toListBy
(x :*: y) x :*: y :*: z ~ ListF [x,y,z] -- etc.
You can create an "empty" one with nilLB
, a "singleton" one with
inject
, or else one from a single t f f
with toListBy
.
See NonEmptyBy
for a "non-empty"
version of this type.
Because t f (I t)
is equivalent to f
, we can always "insert"
f
into t f (I t)
.
This is analogous to inject
from Inject
, but for HBifunctor
s.
Because t (I t) g
is equivalent to f
, we can always "insert"
g
into t (I t) g
.
This is analogous to inject
from Inject
, but for HBifunctor
s.
elim1 :: FunctorBy t f => t f i ~> f Source #
Witnesses the property that i
is the identity of t
: t
f i
always leaves f
unchanged, so we can always just drop the
i
.
elim2 :: FunctorBy t g => t i g ~> g Source #
Witnesses the property that i
is the identity of t
: t i g
always leaves g
unchanged, so we can always just drop the i t
.
appendLB :: t (ListBy t f) (ListBy t f) ~> ListBy t f Source #
If a
represents multiple applications of ListBy
t ft f
to
itself, then we can also "append" two
s applied to
themselves into one giant ListBy
t f
containing all of the ListBy
t ft f
s.
Note that this essentially gives an instance for
, for any functor SemigroupIn
t (ListBy t f)f
; this is witnessed by
WrapLB
.
splitNE :: NonEmptyBy t f ~> t f (ListBy t f) Source #
Lets you convert an
into a single application of NonEmptyBy
t ff
to
.ListBy
t f
Analogous to a function NonEmpty
a -> (a,
[a])
Note that this is not reversible in general unless we have
.Matchable
t
splittingLB :: ListBy t f <~> (i :+: t f (ListBy t f)) Source #
An
is either empty, or a single application of ListBy
t ft
to f
and ListBy t f
(the "head" and "tail"). This witnesses that
isomorphism.
toListBy :: t f f ~> ListBy t f Source #
Embed a direct application of f
to itself into a
.ListBy
t f
fromNE :: NonEmptyBy t f ~> ListBy t f Source #
is "one or more NonEmptyBy
t ff
s", and 'ListBy t f
is "zero or more
f
s". This function lets us convert from one to the other.
This is analogous to a function
.NonEmpty
a ->
[a]
Note that because t
is not inferrable from the input or output
type, you should call this using -XTypeApplications:
fromNE
@(:*:
) ::NonEmptyF
f a ->ListF
f a fromNE @Comp
::Free1
f a ->Free
f a
Instances
class (Tensor t i, SemigroupIn t f) => MonoidIn t i f where Source #
This class effectively gives us a way to generate a value of f a
based on an i a
, for
. Having this ability makes a lot
of interesting functions possible when used with Tensor
t ibiretract
from
SemigroupIn
that weren't possible without it: it gives us a "base
case" for recursion in a lot of cases.
Essentially, we get an i ~> f
, pureT
, where we can introduce an f
a
as long as we have an i a
.
Formally, if we have
, we are enriching the category of
endofunctors with monoid structure, turning it into a monoidal category.
Different choices of Tensor
t it
give different monoidal categories.
A functor f
is known as a "monoid in the (monoidal) category
of endofunctors on t
" if we can biretract
:
t f f ~> f
and also pureT
:
i ~> f
This gives us a few interesting results in category theory, which you can stil reading about if you don't care:
- All functors are monoids in the monoidal category
on
:+:
- The class of functors that are monoids in the monoidal
category on
:*:
is exactly the functors that are instances ofPlus
. - The class of functors that are monoids in the monoidal
category on
Day
is exactly the functors that are instances ofApplicative
. - The class of functors that are monoids in the monoidal
category on
Comp
is exactly the functors that are instances ofMonad
.
This is the meaning behind the common adage, "monads are just monoids
in the category of endofunctors". It means that if you enrich the
category of endofunctors to be monoidal with Comp
, then the class
of functors that are monoids in that monoidal category are exactly
what monads are. However, the adage is a little misleading: there
are many other ways to enrich the category of endofunctors to be
monoidal, and Comp
is just one of them. Similarly, the class of
functors that are monoids in the category of endofunctors enriched by
Day
are Applicative
.
Note that instances of this class are intended to be written with t
and i
to be fixed type constructors, and f
to be allowed to vary
freely:
instance Monad f => MonoidIn Comp Identity f
Any other sort of instance and it's easy to run into problems with type
inference. If you want to write an instance that's "polymorphic" on
tensor choice, use the WrapHBF
and WrapF
newtype wrappers over type
variables, where the third argument also uses a type constructor:
instance MonoidIn (WrapHBF t) (WrapF i) (MyFunctor t i)
This will prevent problems with overloaded instances.
Nothing
If we have an i
, we can generate an f
based on how it
interacts with t
.
Specialized (and simplified), this type is:
pureT
@Day
::Applicative
f =>Identity
a -> f a --pure
pureT @Comp
::Monad
f => Identity a -> f a --return
pureT @(:*:
) ::Plus
f =>Proxy
a -> f a --zero
Note that because t
appears nowhere in the input or output types,
you must always use this with explicit type application syntax (like
pureT @Day
)
Along with biretract
, this function makes f
a monoid in the
category of endofunctors with respect to tensor t
.
Instances
Conclude f => MonoidIn Night Not f Source # | Instances of |
Inplus f => MonoidIn Night Not f Source # | Since: 0.4.0.0 |
(Apply f, Applicative f) => MonoidIn Day Identity f Source # | Instances of Note that because of typeclass constraints, this requires |
Inplicative f => MonoidIn Day Identity f Source # | |
(Divise f, Divisible f) => MonoidIn Day (Proxy :: Type -> Type) f Source # | Instances of Note that because of typeclass constraints, this requires Since: 0.3.0.0 |
Alt f => MonoidIn These1 (V1 :: Type -> Type) f Source # | |
(Bind f, Monad f) => MonoidIn (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity f Source # | Instances of This instance is the "proof" that "monads are the monoids in the
category of endofunctors (enriched with Note that because of typeclass constraints, this requires |
Plus f => MonoidIn (Product :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) f Source # | Instances of |
MonoidIn (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) f Source # | All functors are monoids in the monoidal category on |
Plus f => MonoidIn ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) f Source # | Instances of |
MonoidIn ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) f Source # | All functors are monoids in the monoidal category on |
(Tensor t i, FunctorBy t f, FunctorBy t (WrapLB t f)) => MonoidIn (WrapHBF t) (WrapF i) (WrapLB t f) Source # | |
(Tensor t i, FunctorBy t (Chain t i f)) => MonoidIn (WrapHBF t) (WrapF i) (Chain t i f) Source # |
|
nilLB :: forall t i f. Tensor t i => i ~> ListBy t f Source #
Create the "empty ListBy
".
If
represents multiple applications of ListBy
t ft f
with
itself, then nilLB
gives us "zero applications of f
".
Note that t
cannot be inferred from the input or output type of
nilLB
, so this function must always be called with -XTypeApplications:
nilLB
@Day
::Identity
~>
Ap
f nilLB @Comp
:: Identity ~>Free
f nilLB @(:*:
) ::Proxy
~>ListF
f
Note that this essentially gives an instance for
, for any functor MonoidIn
t i (ListBy
t f)f
; this is witnessed by WrapLB
.
consLB :: Tensor t i => t f (ListBy t f) ~> ListBy t f Source #
Lets us "cons" an application of f
to the front of an
.ListBy
t f
inL :: forall t i f g. MonoidIn t i g => f ~> t f g Source #
Convenient wrapper over intro1
that lets us introduce an arbitrary
functor g
to the right of an f
.
You can think of this as an HBifunctor
analogue of inject
.
inR :: forall t i f g. MonoidIn t i f => g ~> t f g Source #
Convenient wrapper over intro2
that lets us introduce an arbitrary
functor f
to the right of a g
.
You can think of this as an HBifunctor
analogue of inject
.
Combinators
Functor combinators ** Single
data Coyoneda (f :: Type -> Type) a where #
A covariant Functor
suitable for Yoneda reduction
Instances
A list of f a
s. Can be used to describe a product of many different
values of type f a
.
This is the Free Plus
.
Incidentally, if used with a Contravariant
f
, this is instead the
free Divisible
.
Instances
HTraversable (ListF :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (ListF :: (k -> Type) -> k -> TYPE LiftedRep) Source # | |
HBind (ListF :: (k -> Type) -> k -> TYPE LiftedRep) Source # | |
Inject (ListF :: (k -> Type) -> k -> TYPE LiftedRep) Source # | |
FreeOf Plus (ListF :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # | This could also be |
Plus f => Interpret (ListF :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | A free |
Foldable f => Foldable (ListF f) Source # | |
Defined in Control.Applicative.ListF fold :: Monoid m => ListF f m -> m # foldMap :: Monoid m => (a -> m) -> ListF f a -> m # foldMap' :: Monoid m => (a -> m) -> ListF f a -> m # foldr :: (a -> b -> b) -> b -> ListF f a -> b # foldr' :: (a -> b -> b) -> b -> ListF f a -> b # foldl :: (b -> a -> b) -> b -> ListF f a -> b # foldl' :: (b -> a -> b) -> b -> ListF f a -> b # foldr1 :: (a -> a -> a) -> ListF f a -> a # foldl1 :: (a -> a -> a) -> ListF f a -> a # elem :: Eq a => a -> ListF f a -> Bool # maximum :: Ord a => ListF f a -> a # minimum :: Ord a => ListF f a -> a # | |
Eq1 f => Eq1 (ListF f) Source # | |
Ord1 f => Ord1 (ListF f) Source # | |
Defined in Control.Applicative.ListF | |
Read1 f => Read1 (ListF f) Source # | |
Defined in Control.Applicative.ListF | |
Show1 f => Show1 (ListF f) Source # | |
Contravariant f => Contravariant (ListF f) Source # | Since: 0.3.0.0 |
Traversable f => Traversable (ListF f) Source # | |
Applicative f => Alternative (ListF f) Source # | |
Applicative f => Applicative (ListF f) Source # | |
Functor f => Functor (ListF f) Source # | |
Decidable f => Decidable (ListF f) Source # | Since: 0.3.0.0 |
Contravariant f => Divisible (ListF f) Source # | Since: 0.3.0.0 |
Conclude f => Conclude (ListF f) Source # | Since: 0.3.0.0 |
Decide f => Decide (ListF f) Source # | Since: 0.3.0.0 |
Contravariant f => Divise (ListF f) Source # | Since: 0.3.0.0 |
Invariant f => Invariant (ListF f) Source # | Since: 0.3.0.0 |
Defined in Control.Applicative.ListF | |
Pointed f => Pointed (ListF f) Source # | |
Defined in Control.Applicative.ListF | |
Functor f => Alt (ListF f) Source # | |
Apply f => Apply (ListF f) Source # | |
Functor f => Plus (ListF f) Source # | |
Defined in Control.Applicative.ListF | |
(Typeable a, Typeable f, Typeable k, Data (f a)) => Data (ListF f a) Source # | |
Defined in Control.Applicative.ListF gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ListF f a -> c (ListF f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ListF f a) # toConstr :: ListF f a -> Constr # dataTypeOf :: ListF f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ListF f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ListF f a)) # gmapT :: (forall b. Data b => b -> b) -> ListF f a -> ListF f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ListF f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ListF f a -> r # gmapQ :: (forall d. Data d => d -> u) -> ListF f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ListF f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ListF f a -> m (ListF f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ListF f a -> m (ListF f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ListF f a -> m (ListF f a) # | |
Monoid (ListF f a) Source # | |
Semigroup (ListF f a) Source # | |
Generic (ListF f a) Source # | |
Read (f a) => Read (ListF f a) Source # | |
Show (f a) => Show (ListF f a) Source # | |
Eq (f a) => Eq (ListF f a) Source # | |
Ord (f a) => Ord (ListF f a) Source # | |
Defined in Control.Applicative.ListF | |
type FreeFunctorBy (ListF :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.Final | |
type Rep (ListF f a) Source # | |
Defined in Control.Applicative.ListF |
newtype NonEmptyF f a Source #
A non-empty list of f a
s. Can be used to describe a product between
many different possible values of type f a
.
Essentially:
NonEmptyF
f ~ f -- one f:+:
(f:*:
f) -- two f's :+: (f :*: f :*: f) -- three f's :+: (f :*: f :*: f :*: f) -- four f's :+: ... -- etc.
This is the Free Plus
on any Functor
f
.
Incidentally, if used with a Contravariant
f
, this is instead the
free Divise
.
NonEmptyF | |
|
pattern ProdNonEmpty :: (f :*: ListF f) a -> NonEmptyF f a | Treat a
|
Instances
A maybe f a
.
Can be useful for describing a "an f a
that may or may not be there".
This is the free structure for a "fail"-like typeclass that would only
have zero :: f a
.
Instances
HTraversable (MaybeF :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (MaybeF :: (k -> Type) -> k -> TYPE LiftedRep) Source # | |
HBind (MaybeF :: (k -> Type) -> k -> TYPE LiftedRep) Source # | |
Inject (MaybeF :: (k -> Type) -> k -> TYPE LiftedRep) Source # | |
Plus f => Interpret (MaybeF :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | Technically, |
Foldable f => Foldable (MaybeF f) Source # | |
Defined in Control.Applicative.ListF fold :: Monoid m => MaybeF f m -> m # foldMap :: Monoid m => (a -> m) -> MaybeF f a -> m # foldMap' :: Monoid m => (a -> m) -> MaybeF f a -> m # foldr :: (a -> b -> b) -> b -> MaybeF f a -> b # foldr' :: (a -> b -> b) -> b -> MaybeF f a -> b # foldl :: (b -> a -> b) -> b -> MaybeF f a -> b # foldl' :: (b -> a -> b) -> b -> MaybeF f a -> b # foldr1 :: (a -> a -> a) -> MaybeF f a -> a # foldl1 :: (a -> a -> a) -> MaybeF f a -> a # elem :: Eq a => a -> MaybeF f a -> Bool # maximum :: Ord a => MaybeF f a -> a # minimum :: Ord a => MaybeF f a -> a # | |
Eq1 f => Eq1 (MaybeF f) Source # | |
Ord1 f => Ord1 (MaybeF f) Source # | |
Defined in Control.Applicative.ListF | |
Read1 f => Read1 (MaybeF f) Source # | |
Defined in Control.Applicative.ListF | |
Show1 f => Show1 (MaybeF f) Source # | |
Contravariant f => Contravariant (MaybeF f) Source # | Since: 0.3.3.0 |
Traversable f => Traversable (MaybeF f) Source # | |
Defined in Control.Applicative.ListF | |
Applicative f => Alternative (MaybeF f) Source # | |
Applicative f => Applicative (MaybeF f) Source # | |
Functor f => Functor (MaybeF f) Source # | |
Decidable f => Decidable (MaybeF f) Source # | Since: 0.3.3.0 |
Contravariant f => Divisible (MaybeF f) Source # | Since: 0.3.3.0 |
Conclude f => Conclude (MaybeF f) Source # | Since: 0.3.3.0 |
Decide f => Decide (MaybeF f) Source # | Since: 0.3.3.0 |
Contravariant f => Divise (MaybeF f) Source # | Since: 0.3.3.0 |
Invariant f => Invariant (MaybeF f) Source # | Since: 0.3.3.0 |
Defined in Control.Applicative.ListF | |
Pointed f => Pointed (MaybeF f) Source # | |
Defined in Control.Applicative.ListF | |
Functor f => Alt (MaybeF f) Source # | |
Functor f => Plus (MaybeF f) Source # | |
Defined in Control.Applicative.ListF | |
(Typeable a, Typeable f, Typeable k, Data (f a)) => Data (MaybeF f a) Source # | |
Defined in Control.Applicative.ListF gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MaybeF f a -> c (MaybeF f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (MaybeF f a) # toConstr :: MaybeF f a -> Constr # dataTypeOf :: MaybeF f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (MaybeF f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (MaybeF f a)) # gmapT :: (forall b. Data b => b -> b) -> MaybeF f a -> MaybeF f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MaybeF f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MaybeF f a -> r # gmapQ :: (forall d. Data d => d -> u) -> MaybeF f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> MaybeF f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MaybeF f a -> m (MaybeF f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MaybeF f a -> m (MaybeF f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MaybeF f a -> m (MaybeF f a) # | |
Monoid (MaybeF f a) Source # | |
Semigroup (MaybeF f a) Source # | Picks the first |
Generic (MaybeF f a) Source # | |
Read (f a) => Read (MaybeF f a) Source # | |
Show (f a) => Show (MaybeF f a) Source # | |
Eq (f a) => Eq (MaybeF f a) Source # | |
Ord (f a) => Ord (MaybeF f a) Source # | |
type Rep (MaybeF f a) Source # | |
Defined in Control.Applicative.ListF |
A map of f a
s, indexed by keys of type k
. It can be useful for
represeting a product of many different values of type f a
, each "at"
a different k
location.
Can be considered a combination of EnvT
and
ListF
, in a way --- a
is like a MapF
k f a
with unique (and ordered)
keys.ListF
(EnvT
k f) a
One use case might be to extend a schema with many "options", indexed by some string.
For example, if you had a command line argument parser for a single command
data Command a
Then you can represent a command line argument parser for multiple named commands with
type Commands =MapF
String
Command
See NEMapF
for a non-empty variant, if you want to enforce that your
bag has at least one f a
.
Instances
HTraversable (MapF k :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (MapF k2 :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # | |
Monoid k2 => Inject (MapF k2 :: (k1 -> Type) -> k1 -> TYPE LiftedRep) Source # | Injects into a singleton map at |
(Monoid k, Plus f) => Interpret (MapF k :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
Foldable f => Foldable (MapF k f) Source # | |
Defined in Control.Applicative.ListF fold :: Monoid m => MapF k f m -> m # foldMap :: Monoid m => (a -> m) -> MapF k f a -> m # foldMap' :: Monoid m => (a -> m) -> MapF k f a -> m # foldr :: (a -> b -> b) -> b -> MapF k f a -> b # foldr' :: (a -> b -> b) -> b -> MapF k f a -> b # foldl :: (b -> a -> b) -> b -> MapF k f a -> b # foldl' :: (b -> a -> b) -> b -> MapF k f a -> b # foldr1 :: (a -> a -> a) -> MapF k f a -> a # foldl1 :: (a -> a -> a) -> MapF k f a -> a # elem :: Eq a => a -> MapF k f a -> Bool # maximum :: Ord a => MapF k f a -> a # minimum :: Ord a => MapF k f a -> a # | |
(Eq k, Eq1 f) => Eq1 (MapF k f) Source # | |
(Ord k, Ord1 f) => Ord1 (MapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Ord k, Read k, Read1 f) => Read1 (MapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Show k, Show1 f) => Show1 (MapF k f) Source # | |
Traversable f => Traversable (MapF k f) Source # | |
Defined in Control.Applicative.ListF | |
Functor f => Functor (MapF k f) Source # | |
(Monoid k, Pointed f) => Pointed (MapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Functor f, Ord k) => Alt (MapF k f) Source # | Left-biased union |
(Functor f, Ord k) => Plus (MapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Typeable a, Typeable f, Typeable k2, Data k1, Data (f a), Ord k1) => Data (MapF k1 f a) Source # | |
Defined in Control.Applicative.ListF gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MapF k1 f a -> c (MapF k1 f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (MapF k1 f a) # toConstr :: MapF k1 f a -> Constr # dataTypeOf :: MapF k1 f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (MapF k1 f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (MapF k1 f a)) # gmapT :: (forall b. Data b => b -> b) -> MapF k1 f a -> MapF k1 f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MapF k1 f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MapF k1 f a -> r # gmapQ :: (forall d. Data d => d -> u) -> MapF k1 f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> MapF k1 f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MapF k1 f a -> m (MapF k1 f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MapF k1 f a -> m (MapF k1 f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MapF k1 f a -> m (MapF k1 f a) # | |
(Ord k, Alt f) => Monoid (MapF k f a) Source # | |
(Ord k, Alt f) => Semigroup (MapF k f a) Source # | A union, combining matching keys with |
Generic (MapF k1 f a) Source # | |
(Ord k1, Read k1, Read (f a)) => Read (MapF k1 f a) Source # | |
(Show k1, Show (f a)) => Show (MapF k1 f a) Source # | |
(Eq k1, Eq (f a)) => Eq (MapF k1 f a) Source # | |
(Ord k1, Ord (f a)) => Ord (MapF k1 f a) Source # | |
Defined in Control.Applicative.ListF | |
type Rep (MapF k1 f a) Source # | |
Defined in Control.Applicative.ListF |
A non-empty map of f a
s, indexed by keys of type k
. It can be
useful for represeting a product of many different values of type f a
,
each "at" a different k
location, where you need to have at least one
f a
at all times.
Can be considered a combination of EnvT
and
NonEmptyF
, in a way --- an
is like a NEMapF
k f a
with unique (and ordered)
keys.NonEmptyF
(EnvT
k f) a
See MapF
for some use cases.
Instances
HTraversable (NEMapF k :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 (NEMapF k :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (NEMapF k2 :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # | |
Monoid k2 => Inject (NEMapF k2 :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # | Injects into a singleton map at |
(Monoid k, Alt f) => Interpret (NEMapF k :: (Type -> TYPE LiftedRep) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
Foldable f => Foldable (NEMapF k f) Source # | |
Defined in Control.Applicative.ListF fold :: Monoid m => NEMapF k f m -> m # foldMap :: Monoid m => (a -> m) -> NEMapF k f a -> m # foldMap' :: Monoid m => (a -> m) -> NEMapF k f a -> m # foldr :: (a -> b -> b) -> b -> NEMapF k f a -> b # foldr' :: (a -> b -> b) -> b -> NEMapF k f a -> b # foldl :: (b -> a -> b) -> b -> NEMapF k f a -> b # foldl' :: (b -> a -> b) -> b -> NEMapF k f a -> b # foldr1 :: (a -> a -> a) -> NEMapF k f a -> a # foldl1 :: (a -> a -> a) -> NEMapF k f a -> a # toList :: NEMapF k f a -> [a] # null :: NEMapF k f a -> Bool # length :: NEMapF k f a -> Int # elem :: Eq a => a -> NEMapF k f a -> Bool # maximum :: Ord a => NEMapF k f a -> a # minimum :: Ord a => NEMapF k f a -> a # | |
(Eq k, Eq1 f) => Eq1 (NEMapF k f) Source # | |
(Ord k, Ord1 f) => Ord1 (NEMapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Ord k, Read k, Read1 f) => Read1 (NEMapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Show k, Show1 f) => Show1 (NEMapF k f) Source # | |
Traversable f => Traversable (NEMapF k f) Source # | |
Defined in Control.Applicative.ListF | |
Functor f => Functor (NEMapF k f) Source # | |
(Monoid k, Pointed f) => Pointed (NEMapF k f) Source # | |
Defined in Control.Applicative.ListF | |
(Functor f, Ord k) => Alt (NEMapF k f) Source # | Left-biased union |
Foldable1 f => Foldable1 (NEMapF k f) Source # | |
Traversable1 f => Traversable1 (NEMapF k f) Source # | |
(Typeable a, Typeable f, Typeable k2, Data k1, Data (f a), Ord k1) => Data (NEMapF k1 f a) Source # | |
Defined in Control.Applicative.ListF gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NEMapF k1 f a -> c (NEMapF k1 f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NEMapF k1 f a) # toConstr :: NEMapF k1 f a -> Constr # dataTypeOf :: NEMapF k1 f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (NEMapF k1 f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NEMapF k1 f a)) # gmapT :: (forall b. Data b => b -> b) -> NEMapF k1 f a -> NEMapF k1 f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NEMapF k1 f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NEMapF k1 f a -> r # gmapQ :: (forall d. Data d => d -> u) -> NEMapF k1 f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NEMapF k1 f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NEMapF k1 f a -> m (NEMapF k1 f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NEMapF k1 f a -> m (NEMapF k1 f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NEMapF k1 f a -> m (NEMapF k1 f a) # | |
(Ord k, Alt f) => Semigroup (NEMapF k f a) Source # | A union, combining matching keys with |
Generic (NEMapF k1 f a) Source # | |
(Ord k1, Read k1, Read (f a)) => Read (NEMapF k1 f a) Source # | |
(Show k1, Show (f a)) => Show (NEMapF k1 f a) Source # | |
(Eq k1, Eq (f a)) => Eq (NEMapF k1 f a) Source # | |
(Ord k1, Ord (f a)) => Ord (NEMapF k1 f a) Source # | |
Defined in Control.Applicative.ListF compare :: NEMapF k1 f a -> NEMapF k1 f a -> Ordering # (<) :: NEMapF k1 f a -> NEMapF k1 f a -> Bool # (<=) :: NEMapF k1 f a -> NEMapF k1 f a -> Bool # (>) :: NEMapF k1 f a -> NEMapF k1 f a -> Bool # (>=) :: NEMapF k1 f a -> NEMapF k1 f a -> Bool # | |
type Rep (NEMapF k1 f a) Source # | |
Defined in Control.Applicative.ListF |
data Ap (f :: Type -> Type) a #
The free Applicative
for a Functor
f
.
Instances
HBind Ap Source # | |
Inject Ap Source # | |
FreeOf Applicative Ap Source # | |
Defined in Data.HFunctor.Final type FreeFunctorBy Ap :: (Type -> Type) -> Constraint Source # | |
Applicative f => Interpret Ap (f :: Type -> Type) Source # | A free |
HTraversable Ap Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor Ap Source # | |
Applicative (Ap f) | |
Functor (Ap f) | |
Comonad f => Comonad (Ap f) | |
Apply (Ap f) | |
type FreeFunctorBy Ap Source # | |
Defined in Data.HFunctor.Final |
data Ap1 :: (Type -> Type) -> Type -> Type where Source #
One or more f
s convolved with itself.
Essentially:
Ap1
f ~ f -- one f:+:
(f `Day
` f) -- two f's :+: (f `Day` f `Day` f) -- three f's :+: (f `Day` f `Day` f `Day` f) -- four f's :+: ... -- etc.
Useful if you want to promote an f
to a situation with "at least one
f
sequenced with itself".
Mostly useful for its HFunctor
and Interpret
instance, along with
its relationship with Ap
and Day
.
This is the free Apply
--- Basically a "non-empty" Ap
.
The construction here is based on Ap
, similar to now
NonEmpty
is built on list.
pattern DayAp1 :: Day f (Ap f) a -> Ap1 f a | An |
Instances
HBind Ap1 Source # | |
Inject Ap1 Source # | |
FreeOf Apply Ap1 Source # | |
HTraversable Ap1 Source # | |
Defined in Data.Functor.Apply.Free | |
HTraversable1 Ap1 Source # | |
Defined in Data.Functor.Apply.Free | |
HFunctor Ap1 Source # | |
Apply f => Interpret Ap1 (f :: Type -> Type) Source # | |
Functor (Ap1 f) Source # | |
Invariant (Ap1 f) Source # | Since: 0.3.0.0 |
Defined in Data.Functor.Apply.Free | |
Apply (Ap1 f) Source # | |
type FreeFunctorBy Ap1 Source # | |
Defined in Data.HFunctor.Final |
data Alt (f :: Type -> Type) a #
Instances
HBind Alt Source # | |
Inject Alt Source # | |
FreeOf Alternative Alt Source # | |
Defined in Data.HFunctor.Final type FreeFunctorBy Alt :: (Type -> Type) -> Constraint Source # | |
Alternative f => Interpret Alt (f :: Type -> Type) Source # | A free |
HTraversable Alt Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor Alt Source # | |
Alternative (Alt f) | |
Applicative (Alt f) | |
Functor (Alt f) | |
Alt (Alt f) | |
Apply (Alt f) | |
Monoid (Alt f a) | |
Semigroup (Alt f a) | |
type FreeFunctorBy Alt Source # | |
Defined in Data.HFunctor.Final |
A
is Free
ff
enhanced with "sequential binding" capabilities.
It allows you to sequence multiple f
s one after the other, and also to
determine "what f
to sequence" based on the result of the computation
so far.
Essentially, you can think of this as "giving f
a Monad
instance",
with all that that entails (return
, >>=
, etc.).
Lift f
into it with
. When you finally want to "use" it, you can interpret it into any
monadic context:inject
:: f a -> Free
f a
interpret
::Monad
g => (forall x. f x -> g x) ->Free
f a -> g a
Structurally, this is equivalent to many "nested" f's. A value of type
is either:Free
f a
a
f a
f (f a)
f (f (f a))
- .. etc.
Under the hood, this is the Church-encoded Freer monad. It's
Free
, or F
, but in
a way that is compatible with HFunctor
and
Interpret
.
Instances
The Free Bind
. Imbues any functor f
with a Bind
instance.
Conceptually, this is "Free
without pure". That is, while normally
is an Free
f aa
, a f a
, a f (f a)
, etc., a
is
an Free1
f af a
, f (f a)
, f (f (f a))
, etc. It's a Free
with "at least
one layer of f
", excluding the a
case.
It can be useful as the semigroup formed by :.:
(functor composition):
Sometimes we want an f :.: f
, or an f :.: f :.: f
, or an f :.:
f :.: f :.: f
...just as long as we have at least one f
.
Instances
data Lift (f :: Type -> Type) a #
Applicative functor formed by adding pure computations to a given applicative functor.
Instances
An f a
, along with a Natural
index.
Step
f a ~ (Natural
, f a) Step f ~ ((,) Natural):.:
f -- functor composition
It is the fixed point of infinite applications of :+:
(functor sums).
Intuitively, in an infinite f :+: f :+: f :+: f ...
, you have
exactly one f
somewhere. A
has that Step
f af
, with
a Natural
giving you "where" the f
is in the long chain.
Can be useful for using with the Monoidal
instance of :+:
.
interpret
ing it requires no constraint on the
target context.
Note that this type and its instances equivalent to
.EnvT
(Sum
Natural
)
Instances
HTraversable (Step :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 (Step :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (Step :: (k -> Type) -> k -> Type) Source # | |
HBind (Step :: (k -> Type) -> k -> Type) Source # | |
Inject (Step :: (k -> Type) -> k -> Type) Source # | Injects with 0. |
Interpret (Step :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Foldable f => Foldable (Step f) Source # | |
Defined in Control.Applicative.Step fold :: Monoid m => Step f m -> m # foldMap :: Monoid m => (a -> m) -> Step f a -> m # foldMap' :: Monoid m => (a -> m) -> Step f a -> m # foldr :: (a -> b -> b) -> b -> Step f a -> b # foldr' :: (a -> b -> b) -> b -> Step f a -> b # foldl :: (b -> a -> b) -> b -> Step f a -> b # foldl' :: (b -> a -> b) -> b -> Step f a -> b # foldr1 :: (a -> a -> a) -> Step f a -> a # foldl1 :: (a -> a -> a) -> Step f a -> a # elem :: Eq a => a -> Step f a -> Bool # maximum :: Ord a => Step f a -> a # minimum :: Ord a => Step f a -> a # | |
Eq1 f => Eq1 (Step f) Source # | |
Ord1 f => Ord1 (Step f) Source # | |
Defined in Control.Applicative.Step | |
Read1 f => Read1 (Step f) Source # | |
Defined in Control.Applicative.Step | |
Show1 f => Show1 (Step f) Source # | |
Contravariant f => Contravariant (Step f) Source # | Since: 0.3.0.0 |
Traversable f => Traversable (Step f) Source # | |
Applicative f => Applicative (Step f) Source # | |
Functor f => Functor (Step f) Source # | |
Decidable f => Decidable (Step f) Source # | Since: 0.3.0.0 |
Divisible f => Divisible (Step f) Source # | Since: 0.3.0.0 |
Conclude f => Conclude (Step f) Source # | Since: 0.3.0.0 |
Decide f => Decide (Step f) Source # | Since: 0.3.0.0 |
Divise f => Divise (Step f) Source # | Since: 0.3.0.0 |
Invariant f => Invariant (Step f) Source # | Since: 0.3.0.0 |
Defined in Control.Applicative.Step | |
Pointed f => Pointed (Step f) Source # | |
Defined in Control.Applicative.Step | |
Apply f => Apply (Step f) Source # | Since: 0.3.0.0 |
Foldable1 f => Foldable1 (Step f) Source # | |
Traversable1 f => Traversable1 (Step f) Source # | |
(Typeable a, Typeable f, Typeable k, Data (f a)) => Data (Step f a) Source # | |
Defined in Control.Applicative.Step gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Step f a -> c (Step f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Step f a) # toConstr :: Step f a -> Constr # dataTypeOf :: Step f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Step f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Step f a)) # gmapT :: (forall b. Data b => b -> b) -> Step f a -> Step f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Step f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Step f a -> r # gmapQ :: (forall d. Data d => d -> u) -> Step f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Step f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Step f a -> m (Step f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Step f a -> m (Step f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Step f a -> m (Step f a) # | |
Generic (Step f a) Source # | |
Read (f a) => Read (Step f a) Source # | |
Show (f a) => Show (Step f a) Source # | |
Eq (f a) => Eq (Step f a) Source # | |
Ord (f a) => Ord (Step f a) Source # | |
Defined in Control.Applicative.Step | |
type Rep (Step f a) Source # | |
Defined in Control.Applicative.Step type Rep (Step f a) = D1 ('MetaData "Step" "Control.Applicative.Step" "functor-combinators-0.4.1.1-GvD6BEOdYqeEGstBK8j7zW" 'False) (C1 ('MetaCons "Step" 'PrefixI 'True) (S1 ('MetaSel ('Just "stepPos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: S1 ('MetaSel ('Just "stepVal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)))) |
A non-empty map of Natural
to f a
. Basically, contains multiple
f a
s, each at a given Natural
index.
Steps f a ~Map
Natural
(f a) Steps f ~Map
Natural
:.:
f -- functor composition
It is the fixed point of applications of TheseT
.
You can think of this as an infinite sparse array of f a
s.
Intuitively, in an infinite f `TheseT` f `TheseT` f `TheseT` f ...
,
each of those infinite positions may have an f
in them. However,
because of the at-least-one nature of TheseT
, we know we have at least
one f at one position somewhere.
A
has potentially many Steps
f af
s, each stored at a different
Natural
position, with the guaruntee that at least one f
exists.
Can be useful for using with the Monoidal
instance
of TheseT
.
interpret
ing it requires at least an Alt
instance in the target context, since we have to handle potentially more
than one f
.
This type is essentailly the same as
(except with a different NEMapF
(Sum
Natural
)Semigroup
instance).
Instances
HTraversable (Steps :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 (Steps :: (k1 -> TYPE LiftedRep) -> k1 -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (Steps :: (k -> TYPE LiftedRep) -> k -> TYPE LiftedRep) Source # | |
Inject (Steps :: (k -> TYPE LiftedRep) -> k -> TYPE LiftedRep) Source # | Injects into a singleton map at 0; same behavior as |
Alt f => Interpret (Steps :: (Type -> TYPE LiftedRep) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
Foldable f => Foldable (Steps f) Source # | |
Defined in Control.Applicative.Step fold :: Monoid m => Steps f m -> m # foldMap :: Monoid m => (a -> m) -> Steps f a -> m # foldMap' :: Monoid m => (a -> m) -> Steps f a -> m # foldr :: (a -> b -> b) -> b -> Steps f a -> b # foldr' :: (a -> b -> b) -> b -> Steps f a -> b # foldl :: (b -> a -> b) -> b -> Steps f a -> b # foldl' :: (b -> a -> b) -> b -> Steps f a -> b # foldr1 :: (a -> a -> a) -> Steps f a -> a # foldl1 :: (a -> a -> a) -> Steps f a -> a # elem :: Eq a => a -> Steps f a -> Bool # maximum :: Ord a => Steps f a -> a # minimum :: Ord a => Steps f a -> a # | |
Eq1 f => Eq1 (Steps f) Source # | |
Ord1 f => Ord1 (Steps f) Source # | |
Defined in Control.Applicative.Step | |
Read1 f => Read1 (Steps f) Source # | |
Defined in Control.Applicative.Step | |
Show1 f => Show1 (Steps f) Source # | |
Contravariant f => Contravariant (Steps f) Source # | Since: 0.3.0.0 |
Traversable f => Traversable (Steps f) Source # | |
Functor f => Functor (Steps f) Source # | |
Invariant f => Invariant (Steps f) Source # | Since: 0.3.0.0 |
Defined in Control.Applicative.Step | |
Pointed f => Pointed (Steps f) Source # | |
Defined in Control.Applicative.Step | |
Functor f => Alt (Steps f) Source # | Left-biased untion |
Foldable1 f => Foldable1 (Steps f) Source # | |
Traversable1 f => Traversable1 (Steps f) Source # | |
(Typeable a, Typeable f, Typeable k, Data (f a)) => Data (Steps f a) Source # | |
Defined in Control.Applicative.Step gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Steps f a -> c (Steps f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Steps f a) # toConstr :: Steps f a -> Constr # dataTypeOf :: Steps f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Steps f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Steps f a)) # gmapT :: (forall b. Data b => b -> b) -> Steps f a -> Steps f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Steps f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Steps f a -> r # gmapQ :: (forall d. Data d => d -> u) -> Steps f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Steps f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a) # | |
Semigroup (Steps f a) Source # | Appends the items back-to-back, shifting all of the items in the
second map. Matches the behavior as the fixed-point of |
Generic (Steps f a) Source # | |
Read (f a) => Read (Steps f a) Source # | |
Show (f a) => Show (Steps f a) Source # | |
Eq (f a) => Eq (Steps f a) Source # | |
Ord (f a) => Ord (Steps f a) Source # | |
Defined in Control.Applicative.Step | |
type Rep (Steps f a) Source # | |
Defined in Control.Applicative.Step |
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 ~ ProxyFComposeT
f ProxyF ~ ProxyF
It can be inject
ed into (losing all information), but it is impossible
to ever retract
or
interpret
it.
This is essentially
.ConstF
()
Instances
HTraversable (ProxyF :: (k -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (ProxyF :: (k -> Type) -> k1 -> Type) Source # | |
HBind (ProxyF :: (k -> Type) -> k -> Type) Source # | |
Inject (ProxyF :: (k -> Type) -> k -> Type) Source # | |
Foldable (ProxyF f :: TYPE LiftedRep -> Type) Source # | |
Defined in Data.HFunctor 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 # elem :: Eq a => a -> ProxyF f a -> Bool # maximum :: Ord a => ProxyF f a -> a # minimum :: Ord a => ProxyF f a -> a # | |
Eq1 (ProxyF f :: Type -> Type) Source # | |
Ord1 (ProxyF f :: Type -> Type) Source # | |
Defined in Data.HFunctor | |
Read1 (ProxyF f :: Type -> Type) Source # | |
Defined in Data.HFunctor | |
Show1 (ProxyF f :: TYPE LiftedRep -> Type) Source # | |
Contravariant (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Traversable (ProxyF f :: TYPE LiftedRep -> Type) Source # | |
Functor (ProxyF f :: TYPE LiftedRep -> Type) Source # | |
Decidable (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Divisible (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Conclude (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Decide (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Divise (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Invariant (ProxyF f :: Type -> Type) Source # | Since: 0.3.0.0 |
Defined in Data.HFunctor | |
(Typeable f, Typeable a, Typeable k1, Typeable k2) => Data (ProxyF f a) Source # | |
Defined in Data.HFunctor 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 # | |
Read (ProxyF f a) Source # | |
Show (ProxyF f a) Source # | |
Eq (ProxyF f a) Source # | |
Ord (ProxyF f a) Source # | |
type Rep (ProxyF 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 inject
ed into (losing all information), but it is impossible
to ever retract
or
interpret
it.
Instances
HTraversable (ConstF e :: (k -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (ConstF e :: (k -> Type) -> k1 -> Type) Source # | |
Monoid e => Inject (ConstF e :: (k -> Type) -> k -> Type) Source # | |
Foldable (ConstF e f :: TYPE LiftedRep -> Type) Source # | |
Defined in Data.HFunctor 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 # | |
Eq e => Eq1 (ConstF e f :: Type -> Type) Source # | |
Ord e => Ord1 (ConstF e f :: Type -> Type) Source # | |
Defined in Data.HFunctor | |
Read e => Read1 (ConstF e f :: Type -> Type) Source # | |
Defined in Data.HFunctor | |
Show e => Show1 (ConstF e f :: TYPE LiftedRep -> Type) Source # | |
Contravariant (ConstF e f :: Type -> Type) Source # | Since: 0.3.0.0 |
Traversable (ConstF e f :: TYPE LiftedRep -> Type) Source # | |
Defined in Data.HFunctor | |
Functor (ConstF e f :: TYPE LiftedRep -> Type) Source # | |
Monoid e => Divisible (ConstF e f :: Type -> Type) Source # | Since: 0.3.0.0 |
Semigroup e => Divise (ConstF e f :: Type -> Type) Source # | Since: 0.3.0.0 |
Invariant (ConstF e f :: Type -> Type) Source # | Since: 0.3.0.0 |
Defined in Data.HFunctor | |
(Typeable f, Typeable a, Typeable k1, Typeable k2, Data e) => Data (ConstF e f a) Source # | |
Defined in Data.HFunctor 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 # | |
Read e => Read (ConstF e f a) Source # | |
Show e => Show (ConstF e f a) Source # | |
Eq e => Eq (ConstF e f a) Source # | |
Ord e => Ord (ConstF e f a) Source # | |
Defined in Data.HFunctor | |
type Rep (ConstF e f a) Source # | |
Defined in Data.HFunctor |
data EnvT e (w :: Type -> Type) a #
EnvT e (w a) |
Instances
HTraversable (EnvT e :: (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 (EnvT e :: (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (EnvT e :: (Type -> Type) -> Type -> Type) Source # | |
Monoid e => HBind (EnvT e :: (Type -> Type) -> Type -> Type) Source # | Combines the accumulators, Writer-style |
Monoid e => Inject (EnvT e :: (Type -> Type) -> Type -> Type) Source # | |
Monoid e => Interpret (EnvT e :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
ComonadHoist (EnvT e) | |
ComonadTrans (EnvT e) | |
Defined in Control.Comonad.Trans.Env | |
Foldable w => Foldable (EnvT e w) | |
Defined in Control.Comonad.Trans.Env fold :: Monoid m => EnvT e w m -> m # foldMap :: Monoid m => (a -> m) -> EnvT e w a -> m # foldMap' :: Monoid m => (a -> m) -> EnvT e w a -> m # foldr :: (a -> b -> b) -> b -> EnvT e w a -> b # foldr' :: (a -> b -> b) -> b -> EnvT e w a -> b # foldl :: (b -> a -> b) -> b -> EnvT e w a -> b # foldl' :: (b -> a -> b) -> b -> EnvT e w a -> b # foldr1 :: (a -> a -> a) -> EnvT e w a -> a # foldl1 :: (a -> a -> a) -> EnvT e w a -> a # elem :: Eq a => a -> EnvT e w a -> Bool # maximum :: Ord a => EnvT e w a -> a # minimum :: Ord a => EnvT e w a -> a # | |
Traversable w => Traversable (EnvT e w) | |
(Monoid e, Applicative m) => Applicative (EnvT e m) | |
Functor w => Functor (EnvT e w) | |
Comonad w => Comonad (EnvT e w) | |
(Semigroup e, ComonadApply w) => ComonadApply (EnvT e w) | |
(Semigroup e, Apply w) => Apply (EnvT e w) | An |
(Data e, Typeable w, Data (w a), Data a) => Data (EnvT e w a) | |
Defined in Control.Comonad.Trans.Env gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EnvT e w a -> c (EnvT e w a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (EnvT e w a) # toConstr :: EnvT e w a -> Constr # dataTypeOf :: EnvT e w a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (EnvT e w a)) # dataCast2 :: Typeable t => (forall d e0. (Data d, Data e0) => c (t d e0)) -> Maybe (c (EnvT e w a)) # gmapT :: (forall b. Data b => b -> b) -> EnvT e w a -> EnvT e w a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EnvT e w a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EnvT e w a -> r # gmapQ :: (forall d. Data d => d -> u) -> EnvT e w a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EnvT e w a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EnvT e w a -> m (EnvT e w a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EnvT e w a -> m (EnvT e w a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EnvT e w a -> m (EnvT e w a) # |
newtype ReaderT r (m :: Type -> Type) a #
The reader monad transformer, which adds a read-only environment to the given monad.
The return
function ignores the environment, while >>=
passes
the inherited environment to both subcomputations.
ReaderT | |
|
Instances
An f a
, along with a Bool
flag
Flagged
f a ~ (Bool
, f a) Flagged f ~ ((,) Bool):.:
f -- functor composition
Creation with inject
or pure
uses False
as the
boolean.
You can think of it as an f a
that is "flagged" with a boolean value,
and that value can indicuate whether or not it is "pure" (made with
inject
or pure
) as False
, or "impure"
(made from some other source) as True
. However, False
may be always
created directly, of course, using the constructor.
You can think of it like a Step
that is either 0 or 1, as well.
interpret
ing it requires no constraint on the
target context.
This type is equivalent (along with its instances) to:
Flagged | |
|
Instances
HTraversable (Flagged :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 (Flagged :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (Flagged :: (k -> Type) -> k -> Type) Source # | |
HBind (Flagged :: (k -> Type) -> k -> Type) Source # | |
Inject (Flagged :: (k -> Type) -> k -> Type) Source # | Injects with |
Interpret (Flagged :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | |
Foldable f => Foldable (Flagged f) Source # | |
Defined in Control.Applicative.Step fold :: Monoid m => Flagged f m -> m # foldMap :: Monoid m => (a -> m) -> Flagged f a -> m # foldMap' :: Monoid m => (a -> m) -> Flagged f a -> m # foldr :: (a -> b -> b) -> b -> Flagged f a -> b # foldr' :: (a -> b -> b) -> b -> Flagged f a -> b # foldl :: (b -> a -> b) -> b -> Flagged f a -> b # foldl' :: (b -> a -> b) -> b -> Flagged f a -> b # foldr1 :: (a -> a -> a) -> Flagged f a -> a # foldl1 :: (a -> a -> a) -> Flagged f a -> a # toList :: Flagged f a -> [a] # length :: Flagged f a -> Int # elem :: Eq a => a -> Flagged f a -> Bool # maximum :: Ord a => Flagged f a -> a # minimum :: Ord a => Flagged f a -> a # | |
Eq1 f => Eq1 (Flagged f) Source # | |
Ord1 f => Ord1 (Flagged f) Source # | |
Defined in Control.Applicative.Step | |
Read1 f => Read1 (Flagged f) Source # | |
Defined in Control.Applicative.Step | |
Show1 f => Show1 (Flagged f) Source # | |
Traversable f => Traversable (Flagged f) Source # | |
Defined in Control.Applicative.Step | |
Applicative f => Applicative (Flagged f) Source # | |
Functor f => Functor (Flagged f) Source # | |
Pointed f => Pointed (Flagged f) Source # | |
Defined in Control.Applicative.Step | |
Foldable1 f => Foldable1 (Flagged f) Source # | |
Traversable1 f => Traversable1 (Flagged f) Source # | |
(Typeable a, Typeable f, Typeable k, Data (f a)) => Data (Flagged f a) Source # | |
Defined in Control.Applicative.Step gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Flagged f a -> c (Flagged f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Flagged f a) # toConstr :: Flagged f a -> Constr # dataTypeOf :: Flagged f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Flagged f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Flagged f a)) # gmapT :: (forall b. Data b => b -> b) -> Flagged f a -> Flagged f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Flagged f a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Flagged f a -> r # gmapQ :: (forall d. Data d => d -> u) -> Flagged f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Flagged f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a) # | |
Generic (Flagged f a) Source # | |
Read (f a) => Read (Flagged f a) Source # | |
Show (f a) => Show (Flagged f a) Source # | |
Eq (f a) => Eq (Flagged f a) Source # | |
Ord (f a) => Ord (Flagged f a) Source # | |
Defined in Control.Applicative.Step | |
type Rep (Flagged f a) Source # | |
Defined in Control.Applicative.Step type Rep (Flagged f a) = D1 ('MetaData "Flagged" "Control.Applicative.Step" "functor-combinators-0.4.1.1-GvD6BEOdYqeEGstBK8j7zW" 'False) (C1 ('MetaCons "Flagged" 'PrefixI 'True) (S1 ('MetaSel ('Just "flaggedFlag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "flaggedVal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)))) |
newtype IdentityT (f :: k -> Type) (a :: k) #
The trivial monad transformer, which maps a monad to an equivalent monad.
IdentityT | |
|
Instances
is uninhabited for all Void2
a ba
and b
.
Instances
HTraversable (Void2 :: (k -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 (Void2 :: (k -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (Void2 :: (k1 -> Type) -> k2 -> Type) Source # | |
Foldable (Void2 a :: TYPE LiftedRep -> Type) Source # | |
Defined in Control.Applicative.Step fold :: Monoid m => Void2 a m -> m # foldMap :: Monoid m => (a0 -> m) -> Void2 a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Void2 a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Void2 a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Void2 a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Void2 a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Void2 a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Void2 a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Void2 a a0 -> a0 # toList :: Void2 a a0 -> [a0] # elem :: Eq a0 => a0 -> Void2 a a0 -> Bool # maximum :: Ord a0 => Void2 a a0 -> a0 # minimum :: Ord a0 => Void2 a a0 -> a0 # | |
Eq1 (Void2 a :: Type -> Type) Source # | |
Ord1 (Void2 a :: Type -> Type) Source # | |
Defined in Control.Applicative.Step | |
Read1 (Void2 a :: Type -> Type) Source # | |
Defined in Control.Applicative.Step | |
Show1 (Void2 a :: TYPE LiftedRep -> Type) Source # | |
Contravariant (Void2 a :: Type -> Type) Source # | Since: 0.3.0.0 |
Traversable (Void2 a :: TYPE LiftedRep -> Type) Source # | |
Functor (Void2 a :: TYPE LiftedRep -> Type) Source # | |
Invariant (Void2 a :: Type -> Type) Source # | Since: 0.3.0.0 |
Defined in Control.Applicative.Step | |
Alt (Void2 a :: Type -> Type) Source # | |
Apply (Void2 a :: Type -> Type) Source # | |
Bind (Void2 a :: Type -> Type) Source # | |
(Typeable a, Typeable b, Typeable k1, Typeable k2) => Data (Void2 a b) Source # | |
Defined in Control.Applicative.Step gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Void2 a b -> c (Void2 a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Void2 a b) # toConstr :: Void2 a b -> Constr # dataTypeOf :: Void2 a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Void2 a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Void2 a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Void2 a b -> Void2 a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Void2 a b -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Void2 a b -> r # gmapQ :: (forall d. Data d => d -> u) -> Void2 a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Void2 a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b) # | |
Semigroup (Void2 a b) Source # | |
Generic (Void2 a b) Source # | |
Read (Void2 a b) Source # | |
Show (Void2 a b) Source # | |
Eq (Void2 a b) Source # | |
Ord (Void2 a b) Source # | |
Defined in Control.Applicative.Step | |
type Rep (Void2 a b) 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,
is the "free c". Final
c
is the free
Final
Monad
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
as an instance of Final
cc
(using liftFinal0
,
liftFinal1
, liftFinal2
for help).
Instances
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
== idtoFree
.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.
Nothing
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
type FreeFunctorBy t = Unconstrained
Instances
newtype ComposeT (f :: (Type -> Type) -> Type -> Type) (g :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) a infixr 9 #
Composition of monad transformers.
ComposeT infixr 9 | |
|
Instances
(MonadReader r (f (g m)), MonadWriter w (f (g m)), MonadState s (f (g m))) => MonadRWS r w s (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose | |
(HTraversable s, HTraversable t) => HTraversable (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # | |
Defined in Data.HFunctor.HTraversable | |
(HFunctor s, HFunctor t) => HFunctor (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # | |
(Inject s, Inject t) => Inject (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) Source # | |
(MFunctor f, MFunctor g, forall (m :: Type -> Type). Monad m => Monad (g m)) => MFunctor (ComposeT f g :: (Type -> Type) -> Type -> TYPE LiftedRep) | |
(Interpret s f, Interpret t f) => Interpret (ComposeT s t :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # | |
MonadError e (f (g m)) => MonadError e (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose throwError :: e -> ComposeT f g m a # catchError :: ComposeT f g m a -> (e -> ComposeT f g m a) -> ComposeT f g m a # | |
MonadReader r (f (g m)) => MonadReader r (ComposeT f g m) | |
MonadState s (f (g m)) => MonadState s (ComposeT f g m) | |
MonadWriter w (f (g m)) => MonadWriter w (ComposeT f g m) | |
(MFunctor f, MonadTrans f, MonadTrans g) => MonadTrans (ComposeT f g) | |
Defined in Control.Monad.Trans.Compose | |
MonadFail (f (g m)) => MonadFail (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose | |
MonadIO (f (g m)) => MonadIO (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose | |
Foldable (f (g m)) => Foldable (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose fold :: Monoid m0 => ComposeT f g m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> ComposeT f g m a -> m0 # foldMap' :: Monoid m0 => (a -> m0) -> ComposeT f g m a -> m0 # foldr :: (a -> b -> b) -> b -> ComposeT f g m a -> b # foldr' :: (a -> b -> b) -> b -> ComposeT f g m a -> b # foldl :: (b -> a -> b) -> b -> ComposeT f g m a -> b # foldl' :: (b -> a -> b) -> b -> ComposeT f g m a -> b # foldr1 :: (a -> a -> a) -> ComposeT f g m a -> a # foldl1 :: (a -> a -> a) -> ComposeT f g m a -> a # toList :: ComposeT f g m a -> [a] # null :: ComposeT f g m a -> Bool # length :: ComposeT f g m a -> Int # elem :: Eq a => a -> ComposeT f g m a -> Bool # maximum :: Ord a => ComposeT f g m a -> a # minimum :: Ord a => ComposeT f g m a -> a # | |
Traversable (f (g m)) => Traversable (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose traverse :: Applicative f0 => (a -> f0 b) -> ComposeT f g m a -> f0 (ComposeT f g m b) # sequenceA :: Applicative f0 => ComposeT f g m (f0 a) -> f0 (ComposeT f g m a) # mapM :: Monad m0 => (a -> m0 b) -> ComposeT f g m a -> m0 (ComposeT f g m b) # sequence :: Monad m0 => ComposeT f g m (m0 a) -> m0 (ComposeT f g m a) # | |
Alternative (f (g m)) => Alternative (ComposeT f g m) | |
Applicative (f (g m)) => Applicative (ComposeT f g m) | |
Defined in Control.Monad.Trans.Compose pure :: a -> ComposeT f g m a # (<*>) :: ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b # liftA2 :: (a -> b -> c) -> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c # (*>) :: ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b # (<*) :: ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a # | |
Functor (f (g m)) => Functor (ComposeT f g m) | |
Monad (f (g m)) => Monad (ComposeT f g m) | |
MonadPlus (f (g m)) => MonadPlus (ComposeT f g m) | |
MonadCont (f (g m)) => MonadCont (ComposeT f g m) | |
Read (f (g m) a) => Read (ComposeT f g m a) | |
Show (f (g m) a) => Show (ComposeT f g m a) | |
Eq (f (g m) a) => Eq (ComposeT f g m a) | |
Ord (f (g m) a) => Ord (ComposeT f g m a) | |
Defined in Control.Monad.Trans.Compose compare :: ComposeT f g m a -> ComposeT f g m a -> Ordering # (<) :: ComposeT f g m a -> ComposeT f g m a -> Bool # (<=) :: ComposeT f g m a -> ComposeT f g m a -> Bool # (>) :: ComposeT f g m a -> ComposeT f g m a -> Bool # (>=) :: ComposeT f g m a -> ComposeT f g m a -> Bool # max :: ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a # min :: ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a # |
Multi
data Day (f :: Type -> Type) (g :: Type -> Type) a #
The Day convolution of two covariant functors.
Day (f b) (g c) (b -> c -> a) |
Instances
data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) infixr 6 #
Products: encode multiple arguments to constructors
(f p) :*: (g p) infixr 6 |
Instances
HTraversable ((:*:) f :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 ((:*:) f :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor ((:*:) f :: (k -> Type) -> k -> Type) Source # | |
HBifunctor ((:*:) :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> (f :*: g) ~> (j :*: g) Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> (f :*: g) ~> (f :*: l) Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> (f :*: g) ~> (j :*: l) Source # | |
Plus f => HBind ((:*:) f :: (Type -> Type) -> Type -> Type) Source # | |
Plus f => Inject ((:*:) f :: (Type -> Type) -> Type -> Type) Source # | Only uses |
Plus g => Interpret ((:*:) g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |
Generic1 (f :*: g :: k -> Type) | |
Associative ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative type NonEmptyBy (:*:) :: (Type -> Type) -> Type -> Type Source # type FunctorBy (:*:) :: (Type -> Type) -> Constraint Source # associating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy (:*:) f, FunctorBy (:*:) g, FunctorBy (:*:) h) => (f :*: (g :*: h)) <~> ((f :*: g) :*: h) Source # appendNE :: forall (f :: Type -> Type). (NonEmptyBy (:*:) f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f Source # matchNE :: forall (f :: Type -> Type). FunctorBy (:*:) f => NonEmptyBy (:*:) f ~> (f :+: (f :*: NonEmptyBy (:*:) f)) Source # consNE :: forall (f :: Type -> Type). (f :*: NonEmptyBy (:*:) f) ~> NonEmptyBy (:*:) f Source # toNonEmptyBy :: forall (f :: Type -> Type). (f :*: f) ~> NonEmptyBy (:*:) f Source # | |
Alt f => SemigroupIn ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | Instances of |
Matchable ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) Source # | |
Tensor ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> (f :*: Proxy) Source # intro2 :: forall (g :: Type -> Type). g ~> (Proxy :*: g) Source # elim1 :: forall (f :: Type -> Type). FunctorBy (:*:) f => (f :*: Proxy) ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy (:*:) g => (Proxy :*: g) ~> g Source # appendLB :: forall (f :: Type -> Type). (ListBy (:*:) f :*: ListBy (:*:) f) ~> ListBy (:*:) f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy (:*:) f ~> (f :*: ListBy (:*:) f) Source # splittingLB :: forall (f :: Type -> Type). ListBy (:*:) f <~> (Proxy :+: (f :*: ListBy (:*:) f)) Source # toListBy :: forall (f :: Type -> Type). (f :*: f) ~> ListBy (:*:) f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy (:*:) f ~> ListBy (:*:) f Source # | |
Plus f => MonoidIn ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) f Source # | Instances of |
(Representable f, Representable g) => Representable (f :*: g) | |
(GIndex f, GIndex g) => GIndex (f :*: g) | |
Defined in Data.Functor.Rep | |
(GTabulate f, GTabulate g) => GTabulate (f :*: g) | |
Defined in Data.Functor.Rep gtabulate' :: (GRep' (f :*: g) -> a) -> (f :*: g) a | |
(Representable f, Representable g) => Representable (f :*: g) | |
(MonadFix f, MonadFix g) => MonadFix (f :*: g) | Since: base-4.9.0.0 |
Defined in Control.Monad.Fix | |
(Foldable f, Foldable g) => Foldable (f :*: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
(Contravariant f, Contravariant g) => Contravariant (f :*: g) | |
(Traversable f, Traversable g) => Traversable (f :*: g) | Since: base-4.9.0.0 |
(Alternative f, Alternative g) => Alternative (f :*: g) | Since: base-4.9.0.0 |
(Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :*: g) | Since: base-4.9.0.0 |
(Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
(MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) | Since: base-4.9.0.0 |
(Decidable f, Decidable g) => Decidable (f :*: g) | |
(Divisible f, Divisible g) => Divisible (f :*: g) | |
(Conclude f, Conclude g) => Conclude (f :*: g) Source # | |
(Decide f, Decide g) => Decide (f :*: g) Source # | |
(Divise f, Divise g) => Divise (f :*: g) Source # | |
(Inplicative f, Inplicative g) => Inplicative (f :*: g) Source # | Since: 0.4.1.0 |
Defined in Data.Functor.Invariant.Inplicative | |
(Inply f, Inply g) => Inply (f :*: g) Source # | Since: 0.4.1.0 |
(Inalt f, Inalt g) => Inalt (f :*: g) Source # | Since: 0.4.1.0 |
(Inplus f, Inplus g) => Inplus (f :*: g) Source # | Since: 0.4.1.0 |
(Internative f, Internative g) => Internative (f :*: g) Source # | Since: 0.4.1.0 |
Defined in Data.Functor.Invariant.Internative | |
(Invariant l, Invariant r) => Invariant (l :*: r) | from GHC.Generics |
Defined in Data.Functor.Invariant | |
(Pointed f, Pointed g) => Pointed (f :*: g) | |
Defined in Data.Pointed | |
(GUniform f, GUniform g) => GUniform (f :*: g) | |
Defined in System.Random.Internal | |
(Alt f, Alt g) => Alt (f :*: g) | |
Functor f => Alt (Chain1 ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f) Source # |
|
(Apply f, Apply g) => Apply (f :*: g) | |
(Plus f, Plus g) => Plus (f :*: g) | |
Defined in Data.Functor.Plus | |
(Foldable1 f, Foldable1 g) => Foldable1 (f :*: g) | |
(Traversable1 f, Traversable1 g) => Traversable1 (f :*: g) | |
(Typeable f, Typeable g, Data p, Data (f p), Data (g p)) => Data ((f :*: g) p) | Since: base-4.9.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> (f :*: g) p -> c ((f :*: g) p) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ((f :*: g) p) # toConstr :: (f :*: g) p -> Constr # dataTypeOf :: (f :*: g) p -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ((f :*: g) p)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ((f :*: g) p)) # gmapT :: (forall b. Data b => b -> b) -> (f :*: g) p -> (f :*: g) p # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> (f :*: g) p -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> (f :*: g) p -> r # gmapQ :: (forall d. Data d => d -> u) -> (f :*: g) p -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> (f :*: g) p -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> (f :*: g) p -> m ((f :*: g) p) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> (f :*: g) p -> m ((f :*: g) p) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> (f :*: g) p -> m ((f :*: g) p) # | |
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0 |
(Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) | Since: base-4.12.0.0 |
Generic ((f :*: g) p) | |
(Read (f p), Read (g p)) => Read ((f :*: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :*: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | Since: base-4.7.0.0 |
Functor f => Alt (Chain ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) f) Source # | |
Defined in Data.HFunctor.Chain | |
Functor f => Plus (Chain ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (Proxy :: Type -> Type) f) Source # |
|
type Rep1 (f :*: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :*: g :: k -> Type) = D1 ('MetaData ":*:" "GHC.Generics" "base" 'False) (C1 ('MetaCons ":*:" ('InfixI 'RightAssociative 6) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g))) | |
type FunctorBy ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative | |
type NonEmptyBy ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type ListBy ((:*:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type Rep (f :*: g) | |
Defined in Data.Functor.Contravariant.Rep | |
type GRep' (f :*: g) | |
Defined in Data.Functor.Rep | |
type Rep (f :*: g) | |
type Rep ((f :*: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :*: g) p) = D1 ('MetaData ":*:" "GHC.Generics" "base" 'False) (C1 ('MetaCons ":*:" ('InfixI 'RightAssociative 6) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f p)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g p)))) |
data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k) infixr 5 #
Sums: encode choice between constructors
Instances
HTraversable ((:+:) f :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor ((:+:) f :: (k -> Type) -> k -> Type) Source # | |
HBifunctor ((:+:) :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> (f :+: g) ~> (j :+: g) Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> (f :+: g) ~> (f :+: l) Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> (f :+: g) ~> (j :+: l) Source # | |
HBind ((:+:) f :: (k -> Type) -> k -> Type) Source # | |
Inject ((:+:) f :: (k -> Type) -> k -> Type) Source # | |
Plus f => Interpret ((:+:) g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | Technically, |
Generic1 (f :+: g :: k -> Type) | |
(GSum arity a, GSum arity b) => GSum arity (a :+: b) | |
Associative ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative type NonEmptyBy (:+:) :: (Type -> Type) -> Type -> Type Source # type FunctorBy (:+:) :: (Type -> Type) -> Constraint Source # associating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy (:+:) f, FunctorBy (:+:) g, FunctorBy (:+:) h) => (f :+: (g :+: h)) <~> ((f :+: g) :+: h) Source # appendNE :: forall (f :: Type -> Type). (NonEmptyBy (:+:) f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f Source # matchNE :: forall (f :: Type -> Type). FunctorBy (:+:) f => NonEmptyBy (:+:) f ~> (f :+: (f :+: NonEmptyBy (:+:) f)) Source # consNE :: forall (f :: Type -> Type). (f :+: NonEmptyBy (:+:) f) ~> NonEmptyBy (:+:) f Source # toNonEmptyBy :: forall (f :: Type -> Type). (f :+: f) ~> NonEmptyBy (:+:) f Source # | |
SemigroupIn ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | All functors are semigroups in the semigroupoidal category on |
Matchable ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # | |
Tensor ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> (f :+: V1) Source # intro2 :: forall (g :: Type -> Type). g ~> (V1 :+: g) Source # elim1 :: forall (f :: Type -> Type). FunctorBy (:+:) f => (f :+: V1) ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy (:+:) g => (V1 :+: g) ~> g Source # appendLB :: forall (f :: Type -> Type). (ListBy (:+:) f :+: ListBy (:+:) f) ~> ListBy (:+:) f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy (:+:) f ~> (f :+: ListBy (:+:) f) Source # splittingLB :: forall (f :: Type -> Type). ListBy (:+:) f <~> (V1 :+: (f :+: ListBy (:+:) f)) Source # toListBy :: forall (f :: Type -> Type). (f :+: f) ~> ListBy (:+:) f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy (:+:) f ~> ListBy (:+:) f Source # | |
MonoidIn ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) f Source # | All functors are monoids in the monoidal category on |
(Foldable f, Foldable g) => Foldable (f :+: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :+: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldr1 :: (a -> a -> a) -> (f :+: g) a -> a # foldl1 :: (a -> a -> a) -> (f :+: g) a -> a # toList :: (f :+: g) a -> [a] # length :: (f :+: g) a -> Int # elem :: Eq a => a -> (f :+: g) a -> Bool # maximum :: Ord a => (f :+: g) a -> a # minimum :: Ord a => (f :+: g) a -> a # | |
(Contravariant f, Contravariant g) => Contravariant (f :+: g) | |
(Traversable f, Traversable g) => Traversable (f :+: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :+: g) | Since: base-4.9.0.0 |
(GSumGet a, GSumGet b) => GSumGet (a :+: b) | |
(GSumPut a, GSumPut b) => GSumPut (a :+: b) | |
(SumSize a, SumSize b) => SumSize (a :+: b) | |
Defined in Data.Binary.Generic | |
(SumSize a, SumSize b) => SumSize (a :+: b) | |
Defined in Data.Hashable.Generic.Instances | |
(Invariant l, Invariant r) => Invariant (l :+: r) | from GHC.Generics |
Defined in Data.Functor.Invariant | |
(GFinite f, GFinite g) => GUniform (f :+: g) | |
Defined in System.Random.Internal | |
(Foldable1 f, Foldable1 g) => Foldable1 (f :+: g) | |
(Traversable1 f, Traversable1 g) => Traversable1 (f :+: g) | |
(Typeable f, Typeable g, Data p, Data (f p), Data (g p)) => Data ((f :+: g) p) | Since: base-4.9.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> (f :+: g) p -> c ((f :+: g) p) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ((f :+: g) p) # toConstr :: (f :+: g) p -> Constr # dataTypeOf :: (f :+: g) p -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ((f :+: g) p)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ((f :+: g) p)) # gmapT :: (forall b. Data b => b -> b) -> (f :+: g) p -> (f :+: g) p # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> (f :+: g) p -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> (f :+: g) p -> r # gmapQ :: (forall d. Data d => d -> u) -> (f :+: g) p -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> (f :+: g) p -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> (f :+: g) p -> m ((f :+: g) p) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> (f :+: g) p -> m ((f :+: g) p) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> (f :+: g) p -> m ((f :+: g) p) # | |
Generic ((f :+: g) p) | |
(Read (f p), Read (g p)) => Read ((f :+: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :+: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :+: g) p) | Since: base-4.7.0.0 |
type Rep1 (f :+: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :+: g :: k -> Type) = D1 ('MetaData ":+:" "GHC.Generics" "base" 'False) (C1 ('MetaCons "L1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)) :+: C1 ('MetaCons "R1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g))) | |
type FunctorBy ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative | |
type NonEmptyBy ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type ListBy ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type Rep ((f :+: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :+: g) p) = D1 ('MetaData ":+:" "GHC.Generics" "base" 'False) (C1 ('MetaCons "L1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f p))) :+: C1 ('MetaCons "R1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g p)))) |
Void: used for datatypes without constructors
Instances
Generic1 (V1 :: k -> Type) | |
Tensor These1 (V1 :: Type -> Type) Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> These1 f V1 Source # intro2 :: forall (g :: Type -> Type). g ~> These1 V1 g Source # elim1 :: forall (f :: Type -> Type). FunctorBy These1 f => These1 f V1 ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy These1 g => These1 V1 g ~> g Source # appendLB :: forall (f :: Type -> Type). These1 (ListBy These1 f) (ListBy These1 f) ~> ListBy These1 f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy These1 f ~> These1 f (ListBy These1 f) Source # splittingLB :: forall (f :: Type -> Type). ListBy These1 f <~> (V1 :+: These1 f (ListBy These1 f)) Source # toListBy :: forall (f :: Type -> Type). These1 f f ~> ListBy These1 f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy These1 f ~> ListBy These1 f Source # | |
Alt f => MonoidIn These1 (V1 :: Type -> Type) f Source # | |
Foldable (V1 :: TYPE LiftedRep -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => V1 m -> m # foldMap :: Monoid m => (a -> m) -> V1 a -> m # foldMap' :: Monoid m => (a -> m) -> V1 a -> m # foldr :: (a -> b -> b) -> b -> V1 a -> b # foldr' :: (a -> b -> b) -> b -> V1 a -> b # foldl :: (b -> a -> b) -> b -> V1 a -> b # foldl' :: (b -> a -> b) -> b -> V1 a -> b # foldr1 :: (a -> a -> a) -> V1 a -> a # foldl1 :: (a -> a -> a) -> V1 a -> a # elem :: Eq a => a -> V1 a -> Bool # maximum :: Ord a => V1 a -> a # | |
Contravariant (V1 :: Type -> Type) | |
Traversable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (V1 :: TYPE LiftedRep -> Type) | Since: base-4.9.0.0 |
Decide (V1 :: Type -> Type) Source # | |
Divise (V1 :: Type -> Type) Source # | |
Inply (V1 :: Type -> Type) Source # | Since: 0.4.1.0 |
Inalt (V1 :: Type -> Type) Source # | Since: 0.4.1.0 |
Invariant (V1 :: Type -> Type) | from GHC.Generics |
Defined in Data.Functor.Invariant | |
Alt (V1 :: Type -> Type) | |
Apply (V1 :: Type -> Type) | A |
Bind (V1 :: Type -> Type) | |
Foldable1 (V1 :: TYPE LiftedRep -> Type) | |
Traversable1 (V1 :: TYPE LiftedRep -> Type) | |
Matchable (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # | |
Matchable ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # | |
Tensor (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> Sum f V1 Source # intro2 :: forall (g :: Type -> Type). g ~> Sum V1 g Source # elim1 :: forall (f :: Type -> Type). FunctorBy Sum f => Sum f V1 ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy Sum g => Sum V1 g ~> g Source # appendLB :: forall (f :: Type -> Type). Sum (ListBy Sum f) (ListBy Sum f) ~> ListBy Sum f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy Sum f ~> Sum f (ListBy Sum f) Source # splittingLB :: forall (f :: Type -> Type). ListBy Sum f <~> (V1 :+: Sum f (ListBy Sum f)) Source # toListBy :: forall (f :: Type -> Type). Sum f f ~> ListBy Sum f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy Sum f ~> ListBy Sum f Source # | |
Tensor ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> (f :+: V1) Source # intro2 :: forall (g :: Type -> Type). g ~> (V1 :+: g) Source # elim1 :: forall (f :: Type -> Type). FunctorBy (:+:) f => (f :+: V1) ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy (:+:) g => (V1 :+: g) ~> g Source # appendLB :: forall (f :: Type -> Type). (ListBy (:+:) f :+: ListBy (:+:) f) ~> ListBy (:+:) f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy (:+:) f ~> (f :+: ListBy (:+:) f) Source # splittingLB :: forall (f :: Type -> Type). ListBy (:+:) f <~> (V1 :+: (f :+: ListBy (:+:) f)) Source # toListBy :: forall (f :: Type -> Type). (f :+: f) ~> ListBy (:+:) f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy (:+:) f ~> ListBy (:+:) f Source # | |
MonoidIn (Sum :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) f Source # | All functors are monoids in the monoidal category on |
MonoidIn ((:+:) :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (V1 :: Type -> Type) f Source # | All functors are monoids in the monoidal category on |
Data p => Data (V1 p) | Since: base-4.9.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V1 p -> c (V1 p) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V1 p) # dataTypeOf :: V1 p -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V1 p)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 p)) # gmapT :: (forall b. Data b => b -> b) -> V1 p -> V1 p # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 p -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 p -> r # gmapQ :: (forall d. Data d => d -> u) -> V1 p -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> V1 p -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V1 p -> m (V1 p) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V1 p -> m (V1 p) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V1 p -> m (V1 p) # | |
Semigroup (V1 p) | Since: base-4.12.0.0 |
Generic (V1 p) | |
Read (V1 p) | Since: base-4.9.0.0 |
Show (V1 p) | Since: base-4.9.0.0 |
Eq (V1 p) | Since: base-4.9.0.0 |
Ord (V1 p) | Since: base-4.9.0.0 |
type Rep1 (V1 :: k -> Type) | Since: base-4.9.0.0 |
type Rep (V1 p) | Since: base-4.9.0.0 |
data These1 (f :: Type -> Type) (g :: Type -> Type) a #
Instances
Associative These1 Source # | Ideally here |
Defined in Data.HBifunctor.Associative type NonEmptyBy These1 :: (Type -> Type) -> Type -> Type Source # type FunctorBy These1 :: (Type -> Type) -> Constraint Source # associating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy These1 f, FunctorBy These1 g, FunctorBy These1 h) => These1 f (These1 g h) <~> These1 (These1 f g) h Source # appendNE :: forall (f :: Type -> Type). These1 (NonEmptyBy These1 f) (NonEmptyBy These1 f) ~> NonEmptyBy These1 f Source # matchNE :: forall (f :: Type -> Type). FunctorBy These1 f => NonEmptyBy These1 f ~> (f :+: These1 f (NonEmptyBy These1 f)) Source # consNE :: forall (f :: Type -> Type). These1 f (NonEmptyBy These1 f) ~> NonEmptyBy These1 f Source # toNonEmptyBy :: forall (f :: Type -> Type). These1 f f ~> NonEmptyBy These1 f Source # | |
Alt f => SemigroupIn These1 f Source # | |
HBifunctor These1 Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> These1 f g ~> These1 j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> These1 f g ~> These1 f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> These1 f g ~> These1 j l Source # | |
HTraversable (These1 f :: (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor (These1 f :: (Type -> Type) -> Type -> Type) Source # | |
Tensor These1 (V1 :: Type -> Type) Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> These1 f V1 Source # intro2 :: forall (g :: Type -> Type). g ~> These1 V1 g Source # elim1 :: forall (f :: Type -> Type). FunctorBy These1 f => These1 f V1 ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy These1 g => These1 V1 g ~> g Source # appendLB :: forall (f :: Type -> Type). These1 (ListBy These1 f) (ListBy These1 f) ~> ListBy These1 f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy These1 f ~> These1 f (ListBy These1 f) Source # splittingLB :: forall (f :: Type -> Type). ListBy These1 f <~> (V1 :+: These1 f (ListBy These1 f)) Source # toListBy :: forall (f :: Type -> Type). These1 f f ~> ListBy These1 f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy These1 f ~> ListBy These1 f Source # | |
Alt f => HBind (These1 f :: (Type -> Type) -> Type -> Type) Source # | |
Inject (These1 f :: (Type -> Type) -> Type -> Type) Source # | |
Alt f => MonoidIn These1 (V1 :: Type -> Type) f Source # | |
Plus f => Interpret (These1 g :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | Technically, |
Generic1 (These1 f g :: Type -> Type) | |
(Foldable f, Foldable g) => Foldable (These1 f g) | |
Defined in Data.Functor.These fold :: Monoid m => These1 f g m -> m # foldMap :: Monoid m => (a -> m) -> These1 f g a -> m # foldMap' :: Monoid m => (a -> m) -> These1 f g a -> m # foldr :: (a -> b -> b) -> b -> These1 f g a -> b # foldr' :: (a -> b -> b) -> b -> These1 f g a -> b # foldl :: (b -> a -> b) -> b -> These1 f g a -> b # foldl' :: (b -> a -> b) -> b -> These1 f g a -> b # foldr1 :: (a -> a -> a) -> These1 f g a -> a # foldl1 :: (a -> a -> a) -> These1 f g a -> a # toList :: These1 f g a -> [a] # null :: These1 f g a -> Bool # length :: These1 f g a -> Int # elem :: Eq a => a -> These1 f g a -> Bool # maximum :: Ord a => These1 f g a -> a # minimum :: Ord a => These1 f g a -> a # | |
(Eq1 f, Eq1 g) => Eq1 (These1 f g) | |
(Ord1 f, Ord1 g) => Ord1 (These1 f g) | |
Defined in Data.Functor.These | |
(Read1 f, Read1 g) => Read1 (These1 f g) | |
Defined in Data.Functor.These | |
(Show1 f, Show1 g) => Show1 (These1 f g) | |
(Traversable f, Traversable g) => Traversable (These1 f g) | |
Defined in Data.Functor.These | |
(Functor f, Functor g) => Functor (These1 f g) | |
(NFData1 f, NFData1 g) => NFData1 (These1 f g) | This instance is available only with |
Defined in Data.Functor.These | |
(Typeable f, Typeable g, Typeable a, Data (f a), Data (g a)) => Data (These1 f g a) | |
Defined in Data.Functor.These gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> These1 f g a -> c (These1 f g a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (These1 f g a) # toConstr :: These1 f g a -> Constr # dataTypeOf :: These1 f g a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (These1 f g a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (These1 f g a)) # gmapT :: (forall b. Data b => b -> b) -> These1 f g a -> These1 f g a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> These1 f g a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> These1 f g a -> r # gmapQ :: (forall d. Data d => d -> u) -> These1 f g a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> These1 f g a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> These1 f g a -> m (These1 f g a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> These1 f g a -> m (These1 f g a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> These1 f g a -> m (These1 f g a) # | |
Generic (These1 f g a) | |
(Read1 f, Read1 g, Read a) => Read (These1 f g a) | |
(Show1 f, Show1 g, Show a) => Show (These1 f g a) | |
(NFData1 f, NFData1 g, NFData a) => NFData (These1 f g a) | This instance is available only with |
Defined in Data.Functor.These | |
(Eq1 f, Eq1 g, Eq a) => Eq (These1 f g a) | |
(Ord1 f, Ord1 g, Ord a) => Ord (These1 f g a) | |
Defined in Data.Functor.These | |
type FunctorBy These1 Source # | |
Defined in Data.HBifunctor.Associative | |
type NonEmptyBy These1 Source # | |
type ListBy These1 Source # | |
type Rep1 (These1 f g :: Type -> Type) | |
Defined in Data.Functor.These type Rep1 (These1 f g :: Type -> Type) = D1 ('MetaData "These1" "Data.Functor.These" "these-1.1.1.1-3GmQvGWDVR77oJEgTeukbp" 'False) (C1 ('MetaCons "This1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)) :+: (C1 ('MetaCons "That1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g)) :+: C1 ('MetaCons "These1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g)))) | |
type Rep (These1 f g a) | |
Defined in Data.Functor.These type Rep (These1 f g a) = D1 ('MetaData "These1" "Data.Functor.These" "these-1.1.1.1-3GmQvGWDVR77oJEgTeukbp" 'False) (C1 ('MetaCons "This1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))) :+: (C1 ('MetaCons "That1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g a))) :+: C1 ('MetaCons "These1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g a))))) |
data Night :: (Type -> Type) -> (Type -> Type) -> Type -> Type where Source #
A pairing of invariant functors to create a new invariant functor that represents the "choice" between the two.
A
is a invariant "consumer" and "producer" of Night
f g aa
, and
it does this by either feeding the a
to f
, or feeding the a
to
g
, and then collecting the result from whichever one it was fed to.
Which decision of which path to takes happens at runtime depending
what a
is actually given.
For example, if we have x :: f a
and y :: g b
, then
. This is a consumer/producer of night
x y ::
Night
f g (Either
a b)
s, and
it consumes Either
a bLeft
branches by feeding it to x
, and Right
branches
by feeding it to y
. It then passes back the single result from the one of
the two that was chosen.
Mathematically, this is a invariant day convolution, except with
a different choice of bifunctor (Either
) than the typical one we talk
about in Haskell (which uses (,)
). Therefore, it is an alternative to
the typical Day
convolution --- hence, the name Night
.
Instances
A value of type
is "proof" that Not
aa
is uninhabited.
Instances
A useful shortcut for a common usage: Void
is always not so.
Since: 0.3.1.0
data Comp f g a where Source #
Functor composition.
is equivalent to Comp
f g af (g a)
, and
the Comp
pattern synonym is a way of getting the f (g a)
in
a
.Comp
f g a
For example,
is Maybe
(IO
Bool
)
.Comp
Maybe
IO
Bool
This is mostly useful for its typeclass instances: in particular,
Functor
, Applicative
, HBifunctor
, and
Monoidal
.
This is essentially a version of :.:
and
Compose
that allows for an
HBifunctor
instance.
It is slightly less performant. Using
every once in
a while will concretize a comp
. unComp
Comp
value (if you have
)
and remove some indirection if you have a lot of chained operations.Functor
f
The "free monoid" over Comp
is Free
, and the "free semigroup" over
Comp
is Free1
.
pattern Comp :: Functor f => f (g a) -> Comp f g a | Pattern match on and construct a |
Instances
HFunctor (Comp f :: (k -> Type) -> k -> Type) Source # | |
HBifunctor (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HFunctor.Internal hleft :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type). (f ~> j) -> Comp f g ~> Comp j g Source # hright :: forall (g :: k -> Type) (l :: k -> Type) (f :: k -> Type). (g ~> l) -> Comp f g ~> Comp f l Source # hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type). (f ~> j) -> (g ~> l) -> Comp f g ~> Comp j l Source # | |
Applicative f => Inject (Comp f :: (Type -> Type) -> Type -> Type) Source # | |
Associative (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative type NonEmptyBy Comp :: (Type -> Type) -> Type -> Type Source # type FunctorBy Comp :: (Type -> Type) -> Constraint Source # associating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy Comp f, FunctorBy Comp g, FunctorBy Comp h) => Comp f (Comp g h) <~> Comp (Comp f g) h Source # appendNE :: forall (f :: Type -> Type). Comp (NonEmptyBy Comp f) (NonEmptyBy Comp f) ~> NonEmptyBy Comp f Source # matchNE :: forall (f :: Type -> Type). FunctorBy Comp f => NonEmptyBy Comp f ~> (f :+: Comp f (NonEmptyBy Comp f)) Source # consNE :: forall (f :: Type -> Type). Comp f (NonEmptyBy Comp f) ~> NonEmptyBy Comp f Source # toNonEmptyBy :: forall (f :: Type -> Type). Comp f f ~> NonEmptyBy Comp f Source # | |
Bind f => SemigroupIn (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | Instances of |
Tensor (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity Source # | |
Defined in Data.HBifunctor.Tensor intro1 :: forall (f :: Type -> Type). f ~> Comp f Identity Source # intro2 :: forall (g :: Type -> Type). g ~> Comp Identity g Source # elim1 :: forall (f :: Type -> Type). FunctorBy Comp f => Comp f Identity ~> f Source # elim2 :: forall (g :: Type -> Type). FunctorBy Comp g => Comp Identity g ~> g Source # appendLB :: forall (f :: Type -> Type). Comp (ListBy Comp f) (ListBy Comp f) ~> ListBy Comp f Source # splitNE :: forall (f :: Type -> Type). NonEmptyBy Comp f ~> Comp f (ListBy Comp f) Source # splittingLB :: forall (f :: Type -> Type). ListBy Comp f <~> (Identity :+: Comp f (ListBy Comp f)) Source # toListBy :: forall (f :: Type -> Type). Comp f f ~> ListBy Comp f Source # fromNE :: forall (f :: Type -> Type). NonEmptyBy Comp f ~> ListBy Comp f Source # | |
(Bind f, Monad f) => MonoidIn (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity f Source # | Instances of This instance is the "proof" that "monads are the monoids in the
category of endofunctors (enriched with Note that because of typeclass constraints, this requires |
(Foldable f, Foldable g) => Foldable (Comp f g) Source # | |
Defined in Control.Monad.Freer.Church fold :: Monoid m => Comp f g m -> m # foldMap :: Monoid m => (a -> m) -> Comp f g a -> m # foldMap' :: Monoid m => (a -> m) -> Comp f g a -> m # foldr :: (a -> b -> b) -> b -> Comp f g a -> b # foldr' :: (a -> b -> b) -> b -> Comp f g a -> b # foldl :: (b -> a -> b) -> b -> Comp f g a -> b # foldl' :: (b -> a -> b) -> b -> Comp f g a -> b # foldr1 :: (a -> a -> a) -> Comp f g a -> a # foldl1 :: (a -> a -> a) -> Comp f g a -> a # elem :: Eq a => a -> Comp f g a -> Bool # maximum :: Ord a => Comp f g a -> a # minimum :: Ord a => Comp f g a -> a # | |
(Functor f, Eq1 f, Eq1 g) => Eq1 (Comp f g) Source # | |
(Functor f, Ord1 f, Ord1 g) => Ord1 (Comp f g) Source # | |
Defined in Control.Monad.Freer.Church | |
(Functor f, Read1 f, Read1 g) => Read1 (Comp f g) Source # | |
Defined in Control.Monad.Freer.Church | |
(Functor f, Show1 f, Show1 g) => Show1 (Comp f g) Source # | |
(Traversable f, Traversable g) => Traversable (Comp f g) Source # | |
Defined in Control.Monad.Freer.Church | |
(Alternative f, Alternative g) => Alternative (Comp f g) Source # | |
(Applicative f, Applicative g) => Applicative (Comp f g) Source # | |
Functor g => Functor (Comp f g) Source # | |
(Alt f, Alt g) => Alt (Comp f g) Source # | Since: 0.3.6.0 |
(Apply f, Apply g) => Apply (Comp f g) Source # | Since: 0.3.6.0 |
Functor f => Apply (Chain1 (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f) Source # | |
Defined in Data.HFunctor.Chain | |
Functor f => Bind (Chain1 (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f) Source # |
|
(Plus f, Plus g) => Plus (Comp f g) Source # | Since: 0.3.6.0 |
Defined in Control.Monad.Freer.Church | |
(Functor f, Read1 f, Read1 g, Read a) => Read (Comp f g a) Source # | |
(Functor f, Show1 f, Show1 g, Show a) => Show (Comp f g a) Source # | |
(Functor f, Eq1 f, Eq1 g, Eq a) => Eq (Comp f g a) Source # | |
(Functor f, Ord1 f, Ord1 g, Ord a) => Ord (Comp f g a) Source # | |
Defined in Control.Monad.Freer.Church | |
Applicative (Chain (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity f) Source # | |
Defined in Data.HFunctor.Chain pure :: a -> Chain Comp Identity f a # (<*>) :: Chain Comp Identity f (a -> b) -> Chain Comp Identity f a -> Chain Comp Identity f b # liftA2 :: (a -> b -> c) -> Chain Comp Identity f a -> Chain Comp Identity f b -> Chain Comp Identity f c # (*>) :: Chain Comp Identity f a -> Chain Comp Identity f b -> Chain Comp Identity f b # (<*) :: Chain Comp Identity f a -> Chain Comp Identity f b -> Chain Comp Identity f a # | |
Monad (Chain (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity f) Source # |
|
Apply (Chain (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity f) Source # | |
Defined in Data.HFunctor.Chain (<.>) :: Chain Comp Identity f (a -> b) -> Chain Comp Identity f a -> Chain Comp Identity f b # (.>) :: Chain Comp Identity f a -> Chain Comp Identity f b -> Chain Comp Identity f b # (<.) :: Chain Comp Identity f a -> Chain Comp Identity f b -> Chain Comp Identity f a # liftF2 :: (a -> b -> c) -> Chain Comp Identity f a -> Chain Comp Identity f b -> Chain Comp Identity f c # | |
Bind (Chain (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity f) Source # | |
type FunctorBy (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type NonEmptyBy (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative | |
type ListBy (Comp :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
An HBifunctor
that ignores its second input. Like
a :+:
with no R1
/right branch.
This is Joker
from Data.Bifunctors.Joker, but
given a more sensible name for its purpose.
Instances
HTraversable (LeftF f :: (k -> Type) -> k1 -> Type) Source # | |
Defined in Data.HBifunctor | |
HFunctor (LeftF f :: (k -> Type) -> k1 -> Type) Source # | |
HBifunctor (LeftF :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HBifunctor hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> LeftF f g ~> LeftF j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> LeftF f g ~> LeftF f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> LeftF f g ~> LeftF j l Source # | |
Associative (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative type NonEmptyBy LeftF :: (Type -> Type) -> Type -> Type Source # type FunctorBy LeftF :: (Type -> Type) -> Constraint Source # associating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy LeftF f, FunctorBy LeftF g, FunctorBy LeftF h) => LeftF f (LeftF g h) <~> LeftF (LeftF f g) h Source # appendNE :: forall (f :: Type -> Type). LeftF (NonEmptyBy LeftF f) (NonEmptyBy LeftF f) ~> NonEmptyBy LeftF f Source # matchNE :: forall (f :: Type -> Type). FunctorBy LeftF f => NonEmptyBy LeftF f ~> (f :+: LeftF f (NonEmptyBy LeftF f)) Source # consNE :: forall (f :: Type -> Type). LeftF f (NonEmptyBy LeftF f) ~> NonEmptyBy LeftF f Source # toNonEmptyBy :: forall (f :: Type -> Type). LeftF f f ~> NonEmptyBy LeftF f Source # | |
SemigroupIn (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | |
Foldable f => Bifoldable (LeftF f :: TYPE LiftedRep -> TYPE LiftedRep -> Type) Source # | |
Functor f => Bifunctor (LeftF f :: Type -> Type -> Type) Source # | |
Traversable f => Bitraversable (LeftF f :: Type -> Type -> Type) Source # | |
Defined in Data.HBifunctor bitraverse :: Applicative f0 => (a -> f0 c) -> (b -> f0 d) -> LeftF f a b -> f0 (LeftF f c d) # | |
Applicative f => Biapplicative (LeftF f :: Type -> Type -> Type) Source # | |
Defined in Data.HBifunctor | |
Foldable f => Foldable (LeftF f g) Source # | |
Defined in Data.HBifunctor fold :: Monoid m => LeftF f g m -> m # foldMap :: Monoid m => (a -> m) -> LeftF f g a -> m # foldMap' :: Monoid m => (a -> m) -> LeftF f g a -> m # foldr :: (a -> b -> b) -> b -> LeftF f g a -> b # foldr' :: (a -> b -> b) -> b -> LeftF f g a -> b # foldl :: (b -> a -> b) -> b -> LeftF f g a -> b # foldl' :: (b -> a -> b) -> b -> LeftF f g a -> b # foldr1 :: (a -> a -> a) -> LeftF f g a -> a # foldl1 :: (a -> a -> a) -> LeftF f g a -> a # toList :: LeftF f g a -> [a] # length :: LeftF f g a -> Int # elem :: Eq a => a -> LeftF f g a -> Bool # maximum :: Ord a => LeftF f g a -> a # minimum :: Ord a => LeftF f g a -> a # | |
Eq1 f => Eq1 (LeftF f g) Source # | |
Ord1 f => Ord1 (LeftF f g) Source # | |
Defined in Data.HBifunctor | |
Read1 f => Read1 (LeftF f g) Source # | |
Defined in Data.HBifunctor | |
Show1 f => Show1 (LeftF f g) Source # | |
Traversable f => Traversable (LeftF f g) Source # | |
Functor f => Functor (LeftF f g) Source # | |
(Typeable g, Typeable a, Typeable f, Typeable k1, Typeable k2, Data (f a)) => Data (LeftF f g a) Source # | |
Defined in Data.HBifunctor gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> LeftF f g a -> c (LeftF f g a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LeftF f g a) # toConstr :: LeftF f g a -> Constr # dataTypeOf :: LeftF f g a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (LeftF f g a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LeftF f g a)) # gmapT :: (forall b. Data b => b -> b) -> LeftF f g a -> LeftF f g a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LeftF f g a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LeftF f g a -> r # gmapQ :: (forall d. Data d => d -> u) -> LeftF f g a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LeftF f g a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LeftF f g a -> m (LeftF f g a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftF f g a -> m (LeftF f g a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftF f g a -> m (LeftF f g a) # | |
Generic (LeftF f g a) Source # | |
Read (f a) => Read (LeftF f g a) Source # | |
Show (f a) => Show (LeftF f g a) Source # | |
Eq (f a) => Eq (LeftF f g a) Source # | |
Ord (f a) => Ord (LeftF f g a) Source # | |
Defined in Data.HBifunctor | |
type FunctorBy (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative | |
type NonEmptyBy (LeftF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type Rep (LeftF f g a) Source # | |
Defined in Data.HBifunctor |
An HBifunctor
that ignores its first input. Like
a :+:
with no L1
/left branch.
In its polykinded form (on f
), it is essentially a higher-order
version of Tagged
.
Instances
HTraversable (RightF g :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HBifunctor | |
HFunctor (RightF g :: (k1 -> Type) -> k1 -> Type) Source # | |
HBifunctor (RightF :: (k -> Type) -> (k -> Type) -> k -> Type) Source # | |
Defined in Data.HBifunctor hleft :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type). (f ~> j) -> RightF f g ~> RightF j g Source # hright :: forall (g :: k0 -> Type) (l :: k0 -> Type) (f :: k0 -> Type). (g ~> l) -> RightF f g ~> RightF f l Source # hbimap :: forall (f :: k0 -> Type) (j :: k0 -> Type) (g :: k0 -> Type) (l :: k0 -> Type). (f ~> j) -> (g ~> l) -> RightF f g ~> RightF j l Source # | |
HBind (RightF g :: (k2 -> Type) -> k2 -> Type) Source # | |
Inject (RightF g :: (k2 -> Type) -> k2 -> Type) Source # | |
Interpret (RightF g :: (k2 -> Type) -> k2 -> Type) (f :: k2 -> Type) Source # | |
Associative (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative type NonEmptyBy RightF :: (Type -> Type) -> Type -> Type Source # type FunctorBy RightF :: (Type -> Type) -> Constraint Source # associating :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type). (FunctorBy RightF f, FunctorBy RightF g, FunctorBy RightF h) => RightF f (RightF g h) <~> RightF (RightF f g) h Source # appendNE :: forall (f :: Type -> Type). RightF (NonEmptyBy RightF f) (NonEmptyBy RightF f) ~> NonEmptyBy RightF f Source # matchNE :: forall (f :: Type -> Type). FunctorBy RightF f => NonEmptyBy RightF f ~> (f :+: RightF f (NonEmptyBy RightF f)) Source # consNE :: forall (f :: Type -> Type). RightF f (NonEmptyBy RightF f) ~> NonEmptyBy RightF f Source # toNonEmptyBy :: forall (f :: Type -> Type). RightF f f ~> NonEmptyBy RightF f Source # | |
SemigroupIn (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) f Source # | |
Foldable g => Foldable (RightF f g) Source # | |
Defined in Data.HBifunctor fold :: Monoid m => RightF f g m -> m # foldMap :: Monoid m => (a -> m) -> RightF f g a -> m # foldMap' :: Monoid m => (a -> m) -> RightF f g a -> m # foldr :: (a -> b -> b) -> b -> RightF f g a -> b # foldr' :: (a -> b -> b) -> b -> RightF f g a -> b # foldl :: (b -> a -> b) -> b -> RightF f g a -> b # foldl' :: (b -> a -> b) -> b -> RightF f g a -> b # foldr1 :: (a -> a -> a) -> RightF f g a -> a # foldl1 :: (a -> a -> a) -> RightF f g a -> a # toList :: RightF f g a -> [a] # null :: RightF f g a -> Bool # length :: RightF f g a -> Int # elem :: Eq a => a -> RightF f g a -> Bool # maximum :: Ord a => RightF f g a -> a # minimum :: Ord a => RightF f g a -> a # | |
Eq1 g => Eq1 (RightF f g) Source # | |
Ord1 g => Ord1 (RightF f g) Source # | |
Defined in Data.HBifunctor | |
Read1 g => Read1 (RightF f g) Source # | |
Defined in Data.HBifunctor | |
Show1 g => Show1 (RightF f g) Source # | |
Traversable g => Traversable (RightF f g) Source # | |
Defined in Data.HBifunctor | |
Functor g => Functor (RightF f g) Source # | |
(Typeable f, Typeable a, Typeable g, Typeable k1, Typeable k2, Data (g a)) => Data (RightF f g a) Source # | |
Defined in Data.HBifunctor gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> RightF f g a -> c (RightF f g a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (RightF f g a) # toConstr :: RightF f g a -> Constr # dataTypeOf :: RightF f g a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (RightF f g a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RightF f g a)) # gmapT :: (forall b. Data b => b -> b) -> RightF f g a -> RightF f g a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RightF f g a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RightF f g a -> r # gmapQ :: (forall d. Data d => d -> u) -> RightF f g a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RightF f g a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RightF f g a -> m (RightF f g a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RightF f g a -> m (RightF f g a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RightF f g a -> m (RightF f g a) # | |
Generic (RightF f g a) Source # | |
Read (g a) => Read (RightF f g a) Source # | |
Show (g a) => Show (RightF f g a) Source # | |
Eq (g a) => Eq (RightF f g a) Source # | |
Ord (g a) => Ord (RightF f g a) Source # | |
Defined in Data.HBifunctor | |
type FunctorBy (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.HBifunctor.Associative | |
type NonEmptyBy (RightF :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # | |
type Rep (RightF f g a) Source # | |
Defined in Data.HBifunctor |
Combinator Combinators
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
.
Instances
HTraversable t => HTraversable (HLift t :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 t => HTraversable1 (HLift t :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor t => HFunctor (HLift t :: (k1 -> Type) -> k1 -> Type) Source # | |
HBind t => HBind (HLift t :: (k -> Type) -> k -> Type) Source # | |
HFunctor t => Inject (HLift t :: (k -> Type) -> k -> Type) Source # | |
Interpret t f => Interpret (HLift t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | Never uses |
(Eq1 (t f), Eq1 f) => Eq1 (HLift t f) Source # | |
(Ord1 (t f), Ord1 f) => Ord1 (HLift t f) Source # | |
Defined in Data.HFunctor | |
(Show1 (t f), Show1 f) => Show1 (HLift t f) Source # | |
(Contravariant f, Contravariant (t f)) => Contravariant (HLift t f) Source # | Since: 0.3.0.0 |
(Functor f, Functor (t f)) => Functor (HLift t f) Source # | |
(Invariant f, Invariant (t f)) => Invariant (HLift t f) Source # | Since: 0.3.0.0 |
Defined in Data.HFunctor | |
(Read (f a), Read (t f a)) => Read (HLift t f a) Source # | |
(Show (f a), Show (t f a)) => Show (HLift t f a) Source # | |
(Eq (f a), Eq (t f a)) => Eq (HLift t f a) Source # | |
(Ord (f a), Ord (t f a)) => Ord (HLift t f a) Source # | |
Defined in Data.HFunctor |
An "HFunctor
combinator" that turns an HFunctor
into potentially
infinite nestings of that HFunctor
.
An
is either HFree
t f af 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
Instances
HTraversable t => HTraversable (HFree t :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HTraversable1 t => HTraversable1 (HFree t :: (k1 -> Type) -> k1 -> Type) Source # | |
Defined in Data.HFunctor.HTraversable | |
HFunctor t => HFunctor (HFree t :: (k1 -> Type) -> k1 -> Type) Source # | |
HFunctor t => HBind (HFree t :: (k -> Type) -> k -> Type) Source # | |
HFunctor t => Inject (HFree t :: (k -> Type) -> k -> Type) Source # | |
Interpret t f => Interpret (HFree t :: (k -> Type) -> k -> Type) (f :: k -> Type) Source # | Never uses |
(Show1 (t (HFree t f)), Show1 f) => Show1 (HFree t f) Source # | |
(Contravariant f, Contravariant (t (HFree t f))) => Contravariant (HFree t f) Source # | |
(Functor f, Functor (t (HFree t f))) => Functor (HFree t f) Source # | |
(Invariant f, Invariant (t (HFree t f))) => Invariant (HFree t f) Source # | |
Defined in Data.HFunctor | |
(Show1 (t (HFree t f)), Show1 f, Show a) => Show (HFree t f a) Source # | |
Util
Natural Transformations
generalize :: Applicative f => Identity ~> f Source #
Turn Identity
into any
. Can be useful as an
argument to Applicative
fhmap
, hbimap
, or interpret
.
It is a more general form of generalize
from
mmorph.
Divisible
concludeN :: Conclude f => NP f as -> f (NS I as) Source #
Convenient helper function to build up a Conclude
by providing
each component of it. This makes it much easier to build up longer
chains as opposed to nested calls to decide
and manually peeling off
eithers one-by-one.
For example, if you had a data type
data MyType = MTI Int | MTB Bool | MTS String
and a contravariant consumer Builder
(representing, say, a way to
serialize an item, where intBuilder :: Builder Int
is a serializer of
Int
s), then you could assemble a serializer a MyType
using:
contramap (case MTI x -> Z (I x); MTB y -> S (Z (I y)); MTS z -> S (S (Z (I z)))) $ concludeN $ intBuilder :* boolBuilder :* stringBuilder :* Nil
Some notes on usefulness depending on how many components you have:
- If you have 0 components, use
conclude
. - If you have 1 component, use
inject
directly. - If you have 2 components, use
decide
directly. - If you have 3 or more components, these combinators may be useful; otherwise you'd need to manually peel off eithers one-by-one.
Since: 0.3.0.0