| Copyright | (C) 2021 Edward Kmett | 
|---|---|
| License | BSD-style (see the file LICENSE) | 
| Maintainer | Edward Kmett <ekmett@gmail.com> | 
| Stability | provisional | 
| Portability | portable | 
| Safe Haskell | Safe | 
| Language | Haskell2010 | 
Data.Functor.Contravariant.Divise
Description
This module is only available if building with GHC 8.6 or later, or if the
 +contravariant cabal build flag is available.
Synopsis
- class Contravariant f => Divise f where- divise :: (a -> (b, c)) -> f b -> f c -> f a
 
- gdivise :: (Divise (Rep1 f), Generic1 f) => (a -> (b, c)) -> f b -> f c -> f a
- divised :: Divise f => f a -> f b -> f (a, b)
- gdivised :: (Generic1 f, Divise (Rep1 f)) => f a -> f b -> f (a, b)
- newtype WrappedDivisible f a = WrapDivisible {- unwrapDivisible :: f a
 
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 fDivisible
 fDivisible fconquer.
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  in a way that is associative.Day f)
 a -> f a
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
| Divise Comparison Source # | Since: 5.3.6 | 
| 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 | 
| 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 | 
| Semigroup r => Divise (Op r) Source # | Unlike  Since: 5.3.6 | 
| Divise (Proxy :: Type -> Type) Source # | Since: 5.3.6 | 
| Divise (U1 :: Type -> Type) Source # | Since: 5.3.6 | 
| Divise (V1 :: Type -> Type) Source # | Has no  Since: 5.3.6 | 
| Divisible f => Divise (WrappedDivisible f) Source # | This instance is only available if the  Since: 5.3.6 | 
| Defined in Data.Functor.Contravariant.Divise Methods divise :: (a -> (b, c)) -> WrappedDivisible f b -> WrappedDivisible f c -> WrappedDivisible f a Source # | |
| Divise m => Divise (MaybeT m) Source # | Since: 5.3.6 | 
| Semigroup m => Divise (Const m :: Type -> Type) Source # | Unlike  Since: 5.3.6 | 
| Divise f => Divise (Alt f) Source # | Since: 5.3.6 | 
| Divise f => Divise (Rec1 f) Source # | Since: 5.3.6 | 
| Divise f => Divise (Backwards f) Source # | Since: 5.3.6 | 
| Divise m => Divise (ExceptT e m) Source # | Since: 5.3.6 | 
| Divise f => Divise (IdentityT f) Source # | Since: 5.3.6 | 
| Divise m => Divise (ReaderT r m) Source # | Since: 5.3.6 | 
| Divise m => Divise (StateT s m) Source # | Since: 5.3.6 | 
| Divise m => Divise (StateT s m) Source # | Since: 5.3.6 | 
| Divise m => Divise (WriterT w m) Source # | Since: 5.3.6 | 
| Divise m => Divise (WriterT w m) Source # | Since: 5.3.6 | 
| Semigroup m => Divise (Constant m :: Type -> Type) Source # | Unlike  Since: 5.3.6 | 
| Divise f => Divise (Reverse f) Source # | Since: 5.3.6 | 
| (Divise f, Divise g) => Divise (Product f g) Source # | Since: 5.3.6 | 
| (Divise f, Divise g) => Divise (f :*: g) Source # | Since: 5.3.6 | 
| (Apply f, Divise g) => Divise (Compose f g) Source # | Unlike  Since: 5.3.6 | 
| (Apply f, Divise g) => Divise (f :.: g) Source # | Unlike  Since: 5.3.6 | 
| Divise f => Divise (M1 i c f) Source # | Since: 5.3.6 | 
| Divise m => Divise (RWST r w s m) Source # | Since: 5.3.6 | 
| Divise m => Divise (RWST r w s m) Source # | Since: 5.3.6 | 
gdivise :: (Divise (Rep1 f), Generic1 f) => (a -> (b, c)) -> f b -> f c -> f a Source #
Generic divise. Caveats:
- Will not compile if fis a sum type.
- Will not compile if fcontains fields that do not mention its type variable.
- -XDeriveGenericis not smart enough to make instances where the type variable appears in negative position.
Since: 5.3.8
newtype WrappedDivisible f a Source #
Constructors
| WrapDivisible | |
| Fields 
 | |
Instances
| Contravariant f => Contravariant (WrappedDivisible f) Source # | Since: 5.3.6 | 
| 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 # | This instance is only available if the  Since: 5.3.6 | 
| Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WrappedDivisible f a Source # | |
| Decidable f => Decide (WrappedDivisible f) Source # | This instance is only available if the  Since: 5.3.6 | 
| 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 # | This instance is only available if the  Since: 5.3.6 | 
| Defined in Data.Functor.Contravariant.Divise Methods divise :: (a -> (b, c)) -> WrappedDivisible f b -> WrappedDivisible f c -> WrappedDivisible f a Source # | |