Community
Modules 26

Data.Functor.Contravariant.Conclude

provisional

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

class Decide f => Conclude f

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 as, 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.

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

The consumer that cannot ever receive any input.

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

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.

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'

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

Generic concluded. Caveats are the same as for gconclude.

Instances

25
  • instance Decidable f => Conclude (WrappedDivisible f)

    This instance is only available if the +contravariant cabal flag is enabled.

  • instance Conclude Comparison
  • instance Conclude Equivalence
  • instance Conclude Predicate
  • instance Conclude (Op r)
  • instance Conclude Proxy
  • instance Conclude f => Conclude (Alt f)
  • instance Conclude U1
  • instance Conclude f => Conclude (Rec1 f)
  • instance Conclude f => Conclude (M1 i c f)
  • instance (Conclude f, Conclude g) => Conclude (f :*: g)
  • instance (Apply f, Applicative f, Conclude g) => Conclude (f :.: g)
  • instance Conclude f => Conclude (Backwards f)
  • instance Conclude f => Conclude (IdentityT f)
  • instance Conclude m => Conclude (ReaderT r m)
  • instance Conclude m => Conclude (Lazy.RWST r w s m)
  • instance Conclude m => Conclude (Strict.RWST r w s m)
  • instance (Divisible m, Divise m) => Conclude (MaybeT m)

    This instance is only available if the +contravariant cabal flag is enabled.

  • instance Conclude m => Conclude (Lazy.StateT s m)
  • instance Conclude m => Conclude (Strict.StateT s m)
  • instance Conclude m => Conclude (Lazy.WriterT w m)
  • instance Conclude m => Conclude (Strict.WriterT w m)
  • instance (Apply f, Applicative f, Conclude g) => Conclude (Compose f g)
  • instance (Conclude f, Conclude g) => Conclude (Product f g)
  • instance Conclude f => Conclude (Reverse f)
Maintainer
Edward Kmett <ekmett@gmail.com>
Portability
portable
Copyright
(C) 2021 Edward Kmett
License
BSD-style (see the file LICENSE)
Build record and source files

Community contribution. The service has not verified this documentation.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: 4ac4693dc44e2bb370a93502d1bf29784374032a00ad7b3d02803e3d433c0b16

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.