Copyright | (c) Justin Le 2019 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.Functor.Contravariant.Conclude
Description
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
.