Copyright  (c) Justin Le 2019 

License  BSD3 
Maintainer  justin@jle.im 
Stability  experimental 
Portability  nonportable 
Safe Haskell  None 
Language  Haskell2010 
Synopsis
 class Contravariant f => Divise f where
 divise :: (a > (b, c)) > f b > f c > f a
 divised :: Divise f => f a > f b > f (a, b)
 (<:>) :: Divise f => f a > f a > f a
 dsum1 :: (Foldable1 t, Divise f) => t (f a) > f a
 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 a
s, 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 subconsumers, and
returns the wrapped/combined consumer.
All instances of Divisible
should be instances of Divise
with
.divise
= divide
The guarantee that a function polymorphic over of
provides
that Divise
f
doesn't that any input consumed will be passed to at
least one subconsumer; it won't potentially disappear into the void, as
is possible if Divisible
fconquer
is available.
Mathematically, a functor being an instance of Divise
means that it is
"semgroupoidal" 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
divise :: (a > (b, c)) > f b > f c > f a Source #
Takes a "splitting" method and the two subconsumers, and returns the wrapped/combined consumer.
Instances
(<:>) :: Divise f => f a > f a > f a Source #
The Contravariant version of <>
: split the same input over two
different consumers.
newtype WrappedDivisible f a Source #
WrapDivisible  

Instances
Contravariant f => Contravariant (WrappedDivisible f) Source #  
Defined in Data.Functor.Contravariant.Divise contramap :: (a > b) > WrappedDivisible f b > WrappedDivisible f a # (>$) :: b > WrappedDivisible f b > WrappedDivisible f a #  
Divisible f => Divise (WrappedDivisible f) Source #  
Defined in Data.Functor.Contravariant.Divise divise :: (a > (b, c)) > WrappedDivisible f b > WrappedDivisible f c > WrappedDivisible f a Source #  
Decidable f => Decide (WrappedDivisible f) Source #  
Defined in Data.Functor.Contravariant.Decide decide :: (a > Either b c) > WrappedDivisible f b > WrappedDivisible f c > WrappedDivisible f a Source #  
Decidable f => Conclude (WrappedDivisible f) Source #  
Defined in Data.Functor.Contravariant.Conclude conclude :: (a > Void) > WrappedDivisible f a Source # 