numeric-prelude-0.4.4: An experimental alternative hierarchy of numeric type classes
Safe HaskellNone
LanguageHaskell98

Number.ResidueClass.Maybe

Synopsis

Documentation

data T a Source #

Here we try to provide implementations for zero and one by making the modulus optional. We have to provide non-modulus operations for the cases where both operands have Nothing modulus. This is problematic since operations like (\/) depend essentially on the modulus.

A working version with disabled zero and one can be found ResidueClass.

Constructors

Cons infix 7 

Fields

  • modulus :: !(Maybe a)

    the modulus can be Nothing to denote a generic constant like zero and one which could not be bound to a specific modulus so far

  • representative :: !a
     

Instances

Instances details
(Eq a, C a, C a) => Eq (T a) Source # 
Instance details

Defined in Number.ResidueClass.Maybe

Methods

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

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

Read a => Read (T a) Source # 
Instance details

Defined in Number.ResidueClass.Maybe

Methods

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

readList :: ReadS [T a] #

readPrec :: ReadPrec (T a) #

readListPrec :: ReadPrec [T a] #

Show a => Show (T a) Source # 
Instance details

Defined in Number.ResidueClass.Maybe

Methods

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

show :: T a -> String #

showList :: [T a] -> ShowS #

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

Defined in Number.ResidueClass.Maybe

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 #

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

Defined in Number.ResidueClass.Maybe

Methods

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

one :: T a Source #

fromInteger :: Integer -> 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

lift2 :: Eq a => (a -> a -> a -> a) -> (a -> a -> a) -> T a -> T a -> T a Source #