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 |
Documentation
class Contravariant f => Decide f where Source #
The contravariant analogue of
Alt
.
If one thinks of
f a
as a consumer of
a
s, then
decide
allows one
to handle the consumption of a value by choosing to handle it via
exactly one of two independent consumers. It redirects the input
completely into one of two consumers.
decide
takes the "decision" method and the two potential consumers,
and returns the wrapped/combined consumer.
Mathematically, a functor being an instance of
Decide
means that it is
"semigroupoidal" with respect to the contravariant "either-based" Day
convolution (
data EitherDay f g a = forall b c. EitherDay (f b) (g c) (a -> Either b c)
).
That is, it is possible to define a function
(f
in a way that is associative.
EitherDay
f) a ->
f a
Since: 5.3.6
decide :: (a -> Either b c) -> f b -> f c -> f a Source #
Takes the "decision" method and the two potential consumers, and returns the wrapped/combined consumer.
Instances
Decide Predicate Source # |
Since: 5.3.6 |
Decide Comparison Source # |
Since: 5.3.6 |
Defined in Data.Functor.Contravariant.Decide decide :: (a -> Either b c) -> Comparison b -> Comparison c -> Comparison a Source # |
|
Decide Equivalence Source # |
Since: 5.3.6 |
Defined in Data.Functor.Contravariant.Decide decide :: (a -> Either b c) -> Equivalence b -> Equivalence c -> Equivalence a Source # |
|
Decide ( V1 :: Type -> Type ) Source # |
Has no
Since: 5.3.6 |
Decide ( U1 :: Type -> Type ) Source # |
Since: 5.3.6 |
Decide ( Op r) Source # |
Unlike
Since: 5.3.6 |
Decide ( Proxy :: Type -> Type ) Source # |
Since: 5.3.6 |
Divise m => Decide ( MaybeT m) Source # |
Since: 5.3.6 |
Divise m => Decide ( ListT m) Source # |
Since: 5.3.6 |
Decidable f => Decide ( WrappedDivisible f) Source # |
Since: 5.3.6 |
Defined in Data.Functor.Contravariant.Decide decide :: (a -> Either b c) -> WrappedDivisible f b -> WrappedDivisible f c -> WrappedDivisible f a Source # |
|
Decide f => Decide ( Rec1 f) Source # |
Since: 5.3.6 |
Decide f => Decide ( Alt f) Source # |
Since: 5.3.6 |
Decide f => Decide ( IdentityT f) Source # |
Since: 5.3.6 |
Decide f => Decide ( Reverse f) Source # |
Since: 5.3.6 |
Decide m => Decide ( WriterT w m) Source # |
Since: 5.3.6 |
Decide m => Decide ( WriterT w m) Source # |
Since: 5.3.6 |
Decide m => Decide ( StateT s m) Source # |
Since: 5.3.6 |
Decide m => Decide ( StateT s m) Source # |
Since: 5.3.6 |
Decide m => Decide ( ReaderT r m) Source # |
Since: 5.3.6 |
Decide f => Decide ( Backwards f) Source # |
Since: 5.3.6 |
( Decide f, Decide g) => Decide (f :*: g) Source # |
Since: 5.3.6 |
( Decide f, Decide g) => Decide ( Product f g) Source # |
Since: 5.3.6 |
Decide f => Decide ( M1 i c f) Source # |
Since: 5.3.6 |
( Apply f, Decide g) => Decide (f :.: g) Source # |
Unlike
Since: 5.3.6 |
( Apply f, Decide g) => Decide ( Compose f g) Source # |
Unlike
Since: 5.3.6 |
Decide m => Decide ( RWST r w s m) Source # |
Since: 5.3.6 |
Decide m => Decide ( RWST r w s m) Source # |
Since: 5.3.6 |