Safe Haskell | None |
---|---|
Language | Haskell2010 |
A set with two binary operations, one for addition (srplus
), one for
multiplication (srmul
). Together with a neutral element for srplus
,
named srzero
, and one for srmul
, named srone
.
Synopsis
- class SemiRing a where
- (⊕) :: SemiRing a => a -> a -> a
- (⊗) :: SemiRing a => a -> a -> a
- newtype Viterbi x = Viterbi {
- getViterbi :: x
- newtype MinPlus x = MinPlus {
- getMinPlus :: x
- newtype MaxPlus x = MaxPlus {
- getMaxPlus :: x
- newtype GSemiRing (zeroMonoid :: * -> *) (oneMonoid :: * -> *) (x :: *) = GSemiRing {
- getSemiRing :: x
The SemiRing
type class.
class SemiRing a where Source #
The semiring operations and neutral elements.
Instances
(Ord x, Num x) => SemiRing (Viterbi x) Source # | TODO Shall we have generic instances, or specific ones like TODO Consider either a constraint |
(Ord x, Num x, NumericLimits x) => SemiRing (MinPlus x) Source # | TODO Shall we have generic instances, or specific ones like TODO Consider either a constraint |
(Ord x, Num x, NumericLimits x) => SemiRing (MaxPlus x) Source # | TODO Shall we have generic instances, or specific ones like TODO Consider either a constraint |
Num r => SemiRing (Prob n r) Source # | |
(Semigroup (zeroMonoid x), Monoid (zeroMonoid x), Semigroup (oneMonoid x), Monoid (oneMonoid x)) => SemiRing (GSemiRing zeroMonoid oneMonoid x) Source # | |
Defined in Algebra.Structure.SemiRing |
Newtype wrappers for SemiRing
that make the semiring to use explicit.
The Viterbi SemiRing. It maximizes over the product.
Viterbi | |
|
Instances
The tropical MinPlus SemiRing. It minimizes over the sum.
MinPlus | |
|
Instances
The tropical MaxPlus SemiRing. It maximizes over the sum.
MaxPlus | |
|
Instances
Generic semiring structure encoding.
newtype GSemiRing (zeroMonoid :: * -> *) (oneMonoid :: * -> *) (x :: *) Source #
The generic semiring, defined over two Semigroup
and Monoid
constructions.
It can be used like this:
srzero ∷ GSemiRing Min Sum Int == maxBound
srone ∷ GSemiRing Min Sum Int == 0
It is generally useful to still provide explicit instances, since Min
requires a Bounded
instance.
GSemiRing | |
|
Instances
Eq x => Eq (GSemiRing zeroMonoid oneMonoid x) Source # | |
Ord x => Ord (GSemiRing zeroMonoid oneMonoid x) Source # | |
Defined in Algebra.Structure.SemiRing compare :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> Ordering # (<) :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> Bool # (<=) :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> Bool # (>) :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> Bool # (>=) :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> Bool # max :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x # min :: GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x -> GSemiRing zeroMonoid oneMonoid x # | |
Read x => Read (GSemiRing zeroMonoid oneMonoid x) Source # | |
Show x => Show (GSemiRing zeroMonoid oneMonoid x) Source # | |
Generic (GSemiRing zeroMonoid oneMonoid x) Source # | |
(Semigroup (zeroMonoid x), Monoid (zeroMonoid x), Semigroup (oneMonoid x), Monoid (oneMonoid x)) => SemiRing (GSemiRing zeroMonoid oneMonoid x) Source # | |
Defined in Algebra.Structure.SemiRing | |
type Rep (GSemiRing zeroMonoid oneMonoid x) Source # | |
Defined in Algebra.Structure.SemiRing |