NumericPrelude-0.0: An experimental alternative hierarchy of numeric type classesContentsIndex
Number.ResidueClass.Maybe
Synopsis
data T a = Cons {
modulus :: !(Maybe a)
representative :: !a
}
(/:) :: C a => a -> a -> T a
matchMaybe :: Maybe a -> Maybe a -> Maybe a
isCompatibleMaybe :: Eq a => Maybe a -> Maybe a -> Bool
isCompatible :: Eq a => T a -> T a -> Bool
lift2 :: Eq a => (a -> a -> a -> a) -> (a -> a -> a) -> T a -> T a -> T a
Documentation
data T a

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
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
show/hide Instances
(Eq a, C a) => C (T a)
(Eq a, C a) => C (T a)
(Eq a, C a, C a) => Eq (T a)
(Read a, ??? a) => Read (T a)
(Show a, ??? a) => Show (T a)
(/:) :: C a => a -> a -> T a
r /: m is the residue class containing r with respect to the modulus m
matchMaybe :: Maybe a -> Maybe a -> Maybe a
isCompatibleMaybe :: Eq a => Maybe a -> Maybe a -> Bool
isCompatible :: Eq a => T a -> T a -> Bool
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
Produced by Haddock version 0.7