numeric-prelude-0.4.3: An experimental alternative hierarchy of numeric type classes

Safe HaskellNone
LanguageHaskell98

Number.ResidueClass.Check

Synopsis

Documentation

data T a Source #

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 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.

Constructors

Cons infix 7 

Fields

Instances

Eq a => Eq (T a) Source # 

Methods

(==) :: T a -> T a -> Bool #

(/=) :: T a -> T a -> Bool #

(Read a, C a) => Read (T a) Source # 

Methods

readsPrec :: Int -> ReadS (T a) #

readList :: ReadS [T a] #

readPrec :: ReadPrec (T a) #

readListPrec :: ReadPrec [T a] #

Show a => Show (T a) Source # 

Methods

showsPrec :: Int -> T a -> ShowS #

show :: T a -> String #

showList :: [T a] -> ShowS #

(Eq a, C a) => C (T a) Source # 

Methods

zero :: T a Source #

(+) :: T a -> T a -> T a Source #

(-) :: T a -> T a -> T a Source #

negate :: T a -> T a Source #

C a => C (T a) Source # 

Methods

isZero :: T a -> Bool Source #

(Eq a, C a) => C (T a) Source # 

Methods

(*) :: T a -> T a -> T a Source #

one :: T a Source #

fromInteger :: Integer -> T a Source #

(^) :: T a -> Integer -> T a Source #

(Eq a, C a) => C (T a) Source # 

Methods

(/) :: T a -> T a -> T a Source #

recip :: T a -> T a Source #

fromRational' :: Rational -> T a Source #

(^-) :: T a -> Integer -> T a Source #

(/:) :: C a => a -> a -> T a infix 7 Source #

r /: m is the residue class containing r with respect to the modulus m

isCompatible :: Eq a => T a -> T a -> Bool Source #

Check if two residue classes share the same modulus

maybeCompatible :: Eq a => T a -> T a -> Maybe a Source #

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 #

zero :: C a => a -> T a Source #

one :: C a => a -> T a Source #

fromInteger :: C a => a -> Integer -> T a Source #