Safe Haskell | Safe |
---|---|

Language | Haskell98 |

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
- intSemiring :: Semiring Int
- boolSemiring :: Semiring Bool
- tests :: IO Bool

# Documentation

class Eq a => HasZero a where Source

`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 :: a Source

class (Eq a, Monoid a) => SemiRing a where Source

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 -> Bool Source

Semiring invariant.

boolSemiring :: Semiring Bool Source

The standard semiring on `Bool`

s.