Data.Functor.Contravariant.Conclude

semigroupoids-5.3.7: Semigroupoids: Category sans id

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.Conclude

Description

Synopsis

- class Decide f => Conclude f where
  - conclude :: (a -> Void) -> f a
- concluded :: Conclude f => f Void

# Documentation

class Decide f => Conclude f where #

The contravariant analogue of `Plus`. Adds on to `Decide` the ability to express a combinator that rejects all input, to act as the dead-end. Essentially `Decidable` without a superclass constraint on `Divisible`.

If one thinks of `f a` as a consumer of `a`s, then `conclude` defines a consumer that cannot ever receive any input.

Conclude acts as an identity with `decide`, because any decision that involves `conclude` must necessarily always pick the other option.

That is, for, say,

    decide f x concluded

`f` is the deciding function that picks which of the inputs of `decide` to direct input to; in the situation above, `f` must always direct all input to `x`, and never `concluded`.

Mathematically, a functor being an instance of `Decide` means that it is "monoidal" with respect to the contravariant "either-based" Day convolution described in the documentation of `Decide`. On top of `Decide`, it adds a way to construct an "identity" `conclude` where `decide f x (conclude q) == x`, and `decide g (conclude r) y == y`.

Since: 5.3.6

Methods

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

The consumer that cannot ever receive any input.

#### Instances

Instances details

Conclude Comparison # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Comparison a #
Conclude Equivalence # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Equivalence a #
Conclude Predicate # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Predicate a #
Conclude (Op r) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Op r a #
Conclude (Proxy :: Type -> Type) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Proxy a #
Conclude (U1 :: Type -> Type) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> U1 a #
Decidable f => Conclude (WrappedDivisible f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WrappedDivisible f a #
(Divisible m, Divise m) => Conclude (ListT m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> ListT m a #
(Divisible m, Divise m) => Conclude (MaybeT m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> MaybeT m a #
Conclude f => Conclude (Alt f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Alt f a #
Conclude f => Conclude (Rec1 f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Rec1 f a #
Conclude f => Conclude (Backwards f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Backwards f a #
Conclude f => Conclude (IdentityT f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> IdentityT f a #
Conclude m => Conclude (ReaderT r m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> ReaderT r m a #
Conclude m => Conclude (StateT s m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> StateT s m a #
Conclude m => Conclude (StateT s m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> StateT s m a #
Conclude m => Conclude (WriterT w m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WriterT w m a #
Conclude m => Conclude (WriterT w m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WriterT w m a #
Conclude f => Conclude (Reverse f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Reverse f a #
(Conclude f, Conclude g) => Conclude (Product f g) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Product f g a #
(Conclude f, Conclude g) => Conclude (f :*: g) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> (f :*: g) a #
(Apply f, Applicative f, Conclude g) => Conclude (Compose f g) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Compose f g a #
(Apply f, Applicative f, Conclude g) => Conclude (f :.: g) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> (f :.: g) a #
Conclude f => Conclude (M1 i c f) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> M1 i c f a #
Conclude m => Conclude (RWST r w s m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> RWST r w s m a #
Conclude m => Conclude (RWST r w s m) # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> RWST r w s m a #

concluded :: Conclude f => f Void #

A potentially more meaningful form of `conclude`, the consumer that cannot ever receive any input. That is because it expects only input of type `Void`, but such a type has no values.

    concluded = conclude id

Since: 5.3.6