semigroupoids-6.0.1: 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

This module is only available if building with GHC 8.6 or later, or if the `+contravariant` `cabal` build flag is available.

Synopsis

- class Decide f => Conclude (f :: Type -> Type) where
  - conclude :: (a -> Void) -> f a
- gconclude :: (Generic1 f, Conclude (Rep1 f)) => (a -> Void) -> f a
- concluded :: Conclude f => f Void
- gconcluded :: (Generic1 f, Conclude (Rep1 f)) => f Void

# Documentation

class Decide f => Conclude (f :: Type -> Type) where Source #

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 Source #

The consumer that cannot ever receive any input.

#### Instances

Instances details

Conclude Comparison Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Comparison a Source #
Conclude Equivalence Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Equivalence a Source #
Conclude Predicate Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Predicate a Source #
Conclude (Op r) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Op r a Source #
Conclude (Proxy :: Type -> Type) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Proxy a Source #
Conclude (U1 :: Type -> Type) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> U1 a Source #
Decidable f => Conclude (WrappedDivisible f) Source # | This instance is only available if the `+contravariant` `cabal` flag is enabled. Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WrappedDivisible f a Source #
(Divisible m, Divise m) => Conclude (MaybeT m) Source # | This instance is only available if the `+contravariant` `cabal` flag is enabled. Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> MaybeT m a Source #
Conclude f => Conclude (Alt f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Alt f a Source #
Conclude f => Conclude (Rec1 f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Rec1 f a Source #
Conclude f => Conclude (Backwards f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Backwards f a Source #
Conclude f => Conclude (IdentityT f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> IdentityT f a Source #
Conclude m => Conclude (ReaderT r m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> ReaderT r m a Source #
Conclude m => Conclude (StateT s m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> StateT s m a Source #
Conclude m => Conclude (StateT s m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> StateT s m a Source #
Conclude m => Conclude (WriterT w m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WriterT w m a Source #
Conclude m => Conclude (WriterT w m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> WriterT w m a Source #
Conclude f => Conclude (Reverse f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Reverse f a Source #
(Conclude f, Conclude g) => Conclude (Product f g) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Product f g a Source #
(Conclude f, Conclude g) => Conclude (f :*: g) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> (f :*: g) a Source #
(Apply f, Applicative f, Conclude g) => Conclude (Compose f g) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> Compose f g a Source #
(Apply f, Applicative f, Conclude g) => Conclude (f :.: g) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> (f :.: g) a Source #
Conclude f => Conclude (M1 i c f) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> M1 i c f a Source #
Conclude m => Conclude (RWST r w s m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> RWST r w s m a Source #
Conclude m => Conclude (RWST r w s m) Source # | Since: 5.3.6
Instance details Defined in Data.Functor.Contravariant.Conclude Methods conclude :: (a -> Void) -> RWST r w s m a Source #

gconclude :: (Generic1 f, Conclude (Rep1 f)) => (a -> Void) -> f a Source #

Generic `conclude`. Caveats:

1. Will not compile if `f` is a sum type.
2. Will not compile if `f` contains fields that do not mention its type variable.

Since: 5.3.8

concluded :: Conclude f => f Void Source #

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

gconcluded :: (Generic1 f, Conclude (Rep1 f)) => f Void Source #

Generic `concluded`. Caveats are the same as for `gconclude`.

Since: 5.3.8