|The best solution seems to let modulus be part of the type.
This could happen with a phantom type for modulus
and a run function like Control.Monad.ST.runST.
Then operations with non-matching moduli could be detected at compile time
and zero and one could be generated with the correct modulus.
An alternative trial can be found in module ResidueClassMaybe.
|modulus :: !a|
|representative :: !a|
|r /: m is the residue class containing r with respect to the modulus m
|Check if two residue classes share the same modulus
|fromRepresentative :: C a => a -> a -> T a||Source|
|lift1 :: Eq a => (a -> a -> a) -> T a -> T a||Source|
|lift2 :: Eq a => (a -> a -> a -> a) -> T a -> T a -> T a||Source|
|Produced by Haddock version 2.6.0|