Copyright | (c) Justin Le 2019 |
---|---|
License | BSD3 |
Maintainer | justin@jle.im |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Provides free structures for the various typeclasses of the Divisible
hierarchy.
Since: 0.3.0.0
Synopsis
- newtype Div f a where
- hoistDiv :: forall f g. (f ~> g) -> Div f ~> Div g
- liftDiv :: f ~> Div f
- runDiv :: forall f g. Divisible g => (f ~> g) -> Div f ~> g
- divListF :: forall f. Contravariant f => Div f ~> ListF f
- listFDiv :: ListF f ~> Div f
- newtype Div1 f a where
- hoistDiv1 :: (f ~> g) -> Div1 f ~> Div1 g
- liftDiv1 :: f ~> Div1 f
- toDiv :: Div1 f ~> Div f
- runDiv1 :: Divise g => (f ~> g) -> Div1 f ~> g
- div1NonEmptyF :: Contravariant f => Div1 f ~> NonEmptyF f
- nonEmptyFDiv1 :: NonEmptyF f ~> Div1 f
- data Dec :: (Type -> Type) -> Type -> Type where
- hoistDec :: forall f g. (f ~> g) -> Dec f ~> Dec g
- liftDec :: f ~> Dec f
- runDec :: forall f g. Conclude g => (f ~> g) -> Dec f ~> g
- data Dec1 :: (Type -> Type) -> Type -> Type where
- hoistDec1 :: forall f g. (f ~> g) -> Dec1 f ~> Dec1 g
- liftDec1 :: f ~> Dec1 f
- toDec :: Dec1 f a -> Dec f a
- runDec1 :: Decide g => (f ~> g) -> Dec1 f ~> g
Documentation
The free Divisible
. Used to sequence multiple contravariant
consumers, splitting out the input across all consumers.
This type is essentially ListF
; the only reason why it has to exist
separately outside of ListF
is because the current typeclass hierarchy
isn't compatible with both the covariant Interpret
instance (requiring
Plus
) and the contravariant Interpret
instance (requiring
Divisible
).
The wrapping in Coyoneda
is also to provide a usable
Associative
instance for the contravariant
Day
.
pattern Conquer :: Div f a | Pattern matching on an empty Before v0.3.3.0, this used to be the concrete constructor of |
pattern Divide :: (a -> (b, c)) -> f b -> Div f c -> Div f a | Pattern matching on a non-empty Before v0.3.3.0, this used to be the concrete constructor of |
Instances
FreeOf Divisible Div Source # | Since: 0.3.0.0 |
Contravariant (Div f) Source # | |
Divisible (Div f) Source # | |
Invariant (Div f) Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
Divise (Div f) Source # | |
Inplicative (Div f) Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
Inply (Div f) Source # | |
Inject Div Source # | |
Divisible f => Interpret Div (f :: Type -> Type) Source # | |
HFunctor Div Source # | |
HTraversable Div Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
type FreeFunctorBy Div Source # | |
Defined in Data.HFunctor.Final |
runDiv :: forall f g. Divisible g => (f ~> g) -> Div f ~> g Source #
Interpret a Div
into a context g
, provided g
is Divisible
.
The free Divise
: a non-empty version of Div
.
This type is essentially NonEmptyF
; the only reason why it has to exist
separately outside of NonEmptyF
is because the current typeclass
hierarchy isn't compatible with both the covariant Interpret
instance
(requiring Plus
) and the contravariant Interpret
instance (requiring
Divisible
).
The wrapping in Coyoneda
is also to provide a usable
Associative
instance for the contravariant
Day
.
pattern Div1_ :: (a -> (b, c)) -> f b -> Div f c -> Div1 f a | Pattern matching on a Before v0.3.3.0, this used to be the concrete constructor of Since: 0.3.3.0 |
Instances
FreeOf Divise Div1 Source # | Since: 0.3.0.0 |
Contravariant (Div1 f) Source # | |
Invariant (Div1 f) Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
Divise (Div1 f) Source # | |
Inply (Div1 f) Source # | |
Inject Div1 Source # | |
Divise f => Interpret Div1 (f :: Type -> Type) Source # | |
HFunctor Div1 Source # | |
HTraversable Div1 Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
HTraversable1 Div1 Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free htraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Div1 f a -> h (Div1 g a) Source # | |
type FreeFunctorBy Div1 Source # | |
Defined in Data.HFunctor.Final |
div1NonEmptyF :: Contravariant f => Div1 f ~> NonEmptyF f Source #
data Dec :: (Type -> Type) -> Type -> Type where Source #
The free Decide
. Used to aggregate multiple possible consumers,
directing the input into an appropriate consumer.
Instances
Inject Dec Source # | |
FreeOf Conclude Dec Source # | Since: 0.3.0.0 |
HFunctor Dec Source # | |
Conclude f => Interpret Dec (f :: Type -> Type) Source # | |
HTraversable Dec Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
Contravariant (Dec f) Source # | |
Invariant (Dec f) Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
Decide (Dec f) Source # | |
Conclude (Dec f) Source # | |
Inplus (Dec f) Source # | |
Inalt (Dec f) Source # | |
type FreeFunctorBy Dec Source # | |
Defined in Data.HFunctor.Final |
hoistDec :: forall f g. (f ~> g) -> Dec f ~> Dec g Source #
Map over the underlying context in a Dec
.
data Dec1 :: (Type -> Type) -> Type -> Type where Source #
Instances
Inject Dec1 Source # | |
FreeOf Decide Dec1 Source # | Since: 0.3.0.0 |
HFunctor Dec1 Source # | |
Decide f => Interpret Dec1 (f :: Type -> Type) Source # | |
HTraversable Dec1 Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
HTraversable1 Dec1 Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free htraverse1 :: forall h f g (a :: k). Apply h => (forall (x :: k). f x -> h (g x)) -> Dec1 f a -> h (Dec1 g a) Source # | |
Contravariant (Dec1 f) Source # | |
Invariant (Dec1 f) Source # | |
Defined in Data.Functor.Contravariant.Divisible.Free | |
Decide (Dec1 f) Source # | |
Inalt (Dec1 f) Source # | |
type FreeFunctorBy Dec1 Source # | |
Defined in Data.HFunctor.Final |
hoistDec1 :: forall f g. (f ~> g) -> Dec1 f ~> Dec1 g Source #
Map over the undering context in a Dec1
.