semigroupoids-5.3.7: Semigroupoids: Category sans id
Copyright(C) 2021 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Functor.Contravariant.Divise

Description

 
Synopsis

Documentation

class Contravariant f => Divise f where Source #

The contravariant analogue of Apply; it is Divisible without conquer.

If one thinks of f a as a consumer of as, then divise allows one to handle the consumption of a value by splitting it between two consumers that consume separate parts of a.

divise takes the "splitting" method and the two sub-consumers, and returns the wrapped/combined consumer.

All instances of Divisible should be instances of Divise with divise = divide.

If a function is polymorphic over Divise f (as opposed to Divisible f), we can provide a stronger guarantee: namely, that any input consumed will be passed to at least one sub-consumer. With Divisible f, said input could potentially disappear into the void, as this is possible with conquer.

Mathematically, a functor being an instance of Divise means that it is "semigroupoidal" with respect to the contravariant (tupling) Day convolution. That is, it is possible to define a function (f Day f) a -> f a in a way that is associative.

Since: 5.3.6

Methods

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

Takes a "splitting" method and the two sub-consumers, and returns the wrapped/combined consumer.

Instances

Instances details
Divise Comparison Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise Equivalence Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise Predicate Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Semigroup r => Divise (Op r) Source #

Unlike Divisible, requires only Semigroup on r.

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> Op r b -> Op r c -> Op r a Source #

Divise (Proxy :: Type -> Type) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise (U1 :: Type -> Type) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise (V1 :: Type -> Type) Source #

Has no Divisible instance.

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divisible f => Divise (WrappedDivisible f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise m => Divise (ListT m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> ListT m b -> ListT m c -> ListT m a Source #

Divise m => Divise (MaybeT m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> MaybeT m b -> MaybeT m c -> MaybeT m a Source #

Semigroup m => Divise (Const m :: Type -> Type) Source #

Unlike Divisible, requires only Semigroup on m.

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> Const m b -> Const m c -> Const m a Source #

Divise f => Divise (Alt f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise f => Divise (Rec1 f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise f => Divise (Backwards f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise m => Divise (ErrorT e m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> ErrorT e m b -> ErrorT e m c -> ErrorT e m a Source #

Divise m => Divise (ExceptT e m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> ExceptT e m b -> ExceptT e m c -> ExceptT e m a Source #

Divise f => Divise (IdentityT f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise m => Divise (ReaderT r m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> ReaderT r m b -> ReaderT r m c -> ReaderT r m a Source #

Divise m => Divise (StateT s m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> StateT s m b -> StateT s m c -> StateT s m a Source #

Divise m => Divise (StateT s m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> StateT s m b -> StateT s m c -> StateT s m a Source #

Divise m => Divise (WriterT w m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> WriterT w m b -> WriterT w m c -> WriterT w m a Source #

Divise m => Divise (WriterT w m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> WriterT w m b -> WriterT w m c -> WriterT w m a Source #

Semigroup m => Divise (Constant m :: Type -> Type) Source #

Unlike Divisible, requires only Semigroup on m.

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> Constant m b -> Constant m c -> Constant m a Source #

Divise f => Divise (Reverse f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

(Divise f, Divise g) => Divise (Product f g) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

(Divise f, Divise g) => Divise (f :*: g) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

(Apply f, Divise g) => Divise (Compose f g) Source #

Unlike Divisible, requires only Apply on f.

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

(Apply f, Divise g) => Divise (f :.: g) Source #

Unlike Divisible, requires only Apply on f.

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

Divise f => Divise (M1 i c f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c0)) -> M1 i c f b -> M1 i c f c0 -> M1 i c f a Source #

Divise m => Divise (RWST r w s m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> RWST r w s m b -> RWST r w s m c -> RWST r w s m a Source #

Divise m => Divise (RWST r w s m) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

divise :: (a -> (b, c)) -> RWST r w s m b -> RWST r w s m c -> RWST r w s m a Source #

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

Combine a consumer of a with a consumer of b to get a consumer of (a, b).

divised = divise id

Since: 5.3.6

newtype WrappedDivisible f a Source #

Wrap a Divisible to be used as a member of Divise

Since: 5.3.6

Constructors

WrapDivisible 

Fields

Instances

Instances details
Contravariant f => Contravariant (WrappedDivisible f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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

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

Decidable f => Conclude (WrappedDivisible f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Conclude

Methods

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

Decidable f => Decide (WrappedDivisible f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Decide

Methods

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

Divisible f => Divise (WrappedDivisible f) Source #

Since: 5.3.6

Instance details

Defined in Data.Functor.Contravariant.Divise

Methods

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