HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulesemigroupoids-6.0.1Haskell2010

Data.Functor.Contravariant.Conclude

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

  • 1 class
  • 3 values
classclass Decide f => Conclude (f :: Type -> Type) 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 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.

Methods

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

    The consumer that cannot ever receive any input.

Instances25Conclude, …
valuegconclude :: (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.