Data.Operator.Bottom
- Package
- purescript-higher-order
- Repository
- matthew-hilty/purescript-higher-order
#Bottom1 Source
class Bottom1 (f :: Type -> Type) where
The Bottom1
typeclass represents type constructors f
that have a
distinguished element bottom1
of type forall a. f a
as well as an
associated partial ordering (or at least a notion thereof), for which
bottom1
is the minimum or lowest bound.
Because the notion of minimality entails the notion of comparability,
the semantics of an instance of Bottom1
must be consistent with the
definitional requirements of a partial order. In fact, many instances of
Bottom1
are also instances of PartialOrd1
(and likely Ord1
as well).
In such cases, when a type operator f
is both a registered instance of
Bottom1
and one of PartialOrd1
, it must satisfy the following laws:
- minimality:
x .>=? bottom1 == Just true
Likewise, if f
is an instance of Bottom1
and also an instance of
Ord1
, it must satisfy the following analogous law:
- minimality:
x .>= bottom1
Additionally, higher-order semiring-related laws may also be mandated.
If f
is an instance of a higher-order additive semigroup-like structure
like Alt
, f
's bottom1
value must act as the structure's identity:
- left identity:
bottom1 + x .== x
- right identity:
x + bottom1 .== x
If f
is an instance of a higher-order multiplicative
semigroup-like structure like Applicative
or Monad
, f
's bottom1
value must act as the structure's zero element:
- Left zero:
bottom1 * x .== bottom1
- Right zero:
x * bottom1 .== bottom1
Members
bottom1 :: forall a. f a
Instances
#Bottom1_ Source
class Bottom1_ (f :: Type -> Type) where
The Bottom1_
typeclass represents type constructors f
that have a
distinguished function bottom1_
of type forall a. a -> f a
as well as
an associated partial ordering (or at least a notion thereof), for which
the class of evaluations of bottom1_
constitutes the minimum or lowest
bound.
Because the notion of minimality entails the notion of comparability,
the semantics of an instance of Bottom1_
must be consistent with the
definitional requirements of a partial order. In fact, many instances of
Bottom1_
are also instances of PartialOrd1
(and likely Ord1
as well).
In such cases, when a type operator f
is both a registered instance of
Bottom1_
and one of PartialOrd1
, it must satisfy the following laws:
- minimality:
x .>=? bottom1_ y == Just true
Likewise, if f
is an instance of Bottom1_
and also an instance of
Ord1
, it must satisfy the following analogous law:
- minimality:
x .>= bottom1_ y
Additionally, higher-order semiring-related laws may also be mandated.
If f
is an instance of a higher-order additive semigroup-like structure
like Alt
, f
's bottom1_
value must act as the structure's identity:
- left identity:
bottom1_ x + y .== y
- right identity:
x + bottom1_ y .== x
If f
is an instance of a higher-order multiplicative
semigroup-like structure like Applicative
or Monad
, f
's bottom1_
value must act as the structure's zero element:
- Left zero:
bottom1_ x * y .== bottom1_ x
- Right zero:
x * bottom1_ y .== bottom1_ y
Members
bottom1_ :: forall a. a -> f a
Instances
#Bottom2 Source
class Bottom2 (f :: Type -> Type) (a :: Type) where
The Bottom2
typeclass represents type constructors f
that have a
distinguished function bottom2
of type forall b. a -> f b
(for an
instantiated type parameter a
) as well as an associated partial
ordering (or at least a notion thereof), for which the class of
evaluations of bottom2
constitutes the minimum or lowest bound.
Because the notion of minimality entails the notion of comparability,
the semantics of an instance of Bottom2
must be consistent with the
definitional requirements of a partial order. In fact, many instances of
Bottom2
are also instances of PartialOrd1
(and likely Ord1
as well).
In such cases, when a type operator f
is both a registered instance of
Bottom2
and one of PartialOrd1
, it must satisfy the following law:
- minimality:
x .>=? bottom2 y == Just true
Likewise, if f
is an instance of Bottom2
and also an instance of
Ord1
, it must satisfy the following analogous law:
- minimality:
x .>= bottom2 y
Additionally, higher-order semiring-related laws may also be mandated.
If f
is an instance of a higher-order additive semigroup-like structure
like Alt
, f
's bottom2
value must act as the structure's identity:
- left identity:
bottom2 x + y .== y
- right identity:
x + bottom2 y .== x
If f
is an instance of a higher-order multiplicative
semigroup-like structure like Applicative
or Monad
, f
's bottom2
value must act as the structure's zero element:
- Left zero:
bottom2 x * y .== bottom2 x
- Right zero:
x * bottom2 y .== bottom2 y
Members
bottom2 :: forall b. a -> f b
Instances
Bottom2 (Either a) a
Bottom2 (EitherR a) a
(Monad m) => Bottom2 (ExceptT a m) a
(MonadThrow a m) => Bottom2 (MaybeT m) a
(MonadThrow a m) => Bottom2 (ReaderT r m) a
(MonadThrow a m, Monoid w) => Bottom2 (RWST r w s m) a
(MonadThrow a m) => Bottom2 (StateT s m) a
(Monoid w, MonadThrow a m) => Bottom2 (WriterT w m) a
(Bottom1 f) => Bottom2 f a