| Copyright | (c) Justin Le 2019 |
|---|---|
| License | BSD3 |
| Maintainer | justin@jle.im |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Functor.Contravariant.Divise
Description
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)
- 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
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 sub-consumer; 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
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
newtype WrappedDivisible f a Source #
Constructors
| WrapDivisible | |
Fields
| |
Instances
| Contravariant f => Contravariant (WrappedDivisible f) Source # | |
Defined in Data.Functor.Contravariant.Divise Methods 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 Methods 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 Methods 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 Methods conclude :: (a -> Void) -> WrappedDivisible f a Source # | |