@@ -14,10 +14,10 @@ module Prelude
1414 , Bind, (>>=)
1515 , Monad, return, liftM1, ap
1616 , Semiring, (+), zero, (*), one
17+ , ModuloSemiring, (/), mod
1718 , Ring, (-)
1819 , (%)
1920 , negate
20− , ModuloRing, (/), mod
2121 , DivisionRing
2222 , Num
2323 , Eq, (==), (/=), refEq, refIneq
@@ -217,6 +217,12 @@ module Prelude
217217 (*) :: a -> a -> a
218218 one :: a
219219
220+ -- | Semiring with modulo operation and division where
221+ -- | ```a / b * b + (a `mod` b) = a```
222+ class (Semiring a) <= ModuloSemiring a where
223+ (/) :: a -> a -> a
224+ mod :: a -> a -> a
225+
220226 -- | Addition, multiplication, and subtraction
221227 class (Semiring a) <= Ring a where
222228 (-) :: a -> a -> a
@@ -224,15 +230,9 @@ module Prelude
224230 negate :: forall a. (Ring a) => a -> a
225231 negate a = zero - a
226232
227− -- | Ring with modulo operation and division where
228− -- | ```a / b * b + (a `mod` b) = a```
229− class (Ring a) <= ModuloRing a where
230− (/) :: a -> a -> a
231− mod :: a -> a -> a
232−
233233 -- | Ring where every nonzero element has a multiplicative inverse (possibly
234234 -- | a non-commutative field) so that ```a `mod` b = zero```
235− class (ModuloRing a) <= DivisionRing a
235+ class (Ring a, ModuloSemiring a) <= DivisionRing a
236236
237237 -- | A commutative field
238238 class (DivisionRing a) <= Num a
@@ -293,7 +293,7 @@ module Prelude
293293 instance ringNumber :: Ring Number where
294294 (-) = numSub
295295
296− instance moduloRingNumber :: ModuloRing Number where
296+ instance moduloSemiringNumber :: ModuloSemiring Number where
297297 (/) = numDiv
298298 mod _ _ = 0
299299