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 |
This module is only available if building with GHC 8.6 or later, or if the
+contravariant
cabal
build flag is available.
Documentation
class Decide f => Conclude f 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 xconcluded
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
Instances
gconclude :: (Generic1 f, Conclude (Rep1 f)) => (a -> Void) -> f a Source #
Generic conclude
. Caveats:
- Will not compile if
f
is a sum type. - Will not compile if
f
contains fields that do not mention its type variable.
Since: 5.3.8