| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Numeric.Algebra.Rings.Semiring
Description
Provides the Semiring typeclass.
Since: 0.1
Documentation
class (Demiring r, Hemiring r) => Semiring r Source #
Defines a semiring i.e. a structure that is both an Hemiring and
Demiring. In other words, a structure that is both an additive and
multiplicative monoid.
Examples:
- \( \mathbb{Z}^{+} \), the non-negative integers.
>>>:{-- Addition f1 :: (Semiring r) => r -> r f1 x = x .+. x :}
>>>f1 510
>>>:{-- Zero f2 :: (Semiring r) => r -> r f2 x = x .+. zero :}
>>>f2 55
>>>:{-- Multiplication f3 :: (Semiring r) => r -> r f3 x = x .*. x :}
>>>f3 525
>>>:{-- One f4 :: (Semiring r) => r -> r f4 x = x .*. one :}
>>>f4 55
Since: 0.1