Safe Haskell | Safe-Infered |
---|

Semirings.

- class Eq a => HasZero a where
- zeroElement :: a

- class (Eq a, Monoid a) => SemiRing a where
- multiply :: a -> a -> a

- data Semiring a = Semiring {}
- semiringInvariant :: (Arbitrary a, Eq a, Show a) => Semiring a -> a -> a -> a -> Bool
- integerSemiring :: Semiring Integer
- boolSemiring :: Semiring Bool
- tests :: IO Bool

# Documentation

class Eq a => HasZero a whereSource

`HasZero`

is needed for sparse matrices, to tell which is the element
that does not have to be stored.
It is a cut-down version of `SemiRing`

which is definable
without the implicit `?cutoff`

.

zeroElement :: aSource

class (Eq a, Monoid a) => SemiRing a whereSource

SemiRing type class. Additive monoid with multiplication operation. Inherit addition and zero from Monoid.

Semirings.

semiringInvariant :: (Arbitrary a, Eq a, Show a) => Semiring a -> a -> a -> a -> BoolSource

Semiring invariant.

boolSemiring :: Semiring BoolSource

The standard semiring on `Bool`

s.