numtype-1.2: Type-level (low cardinality) integers.

CopyrightCopyright (C) 2006-2009 Bjorn Buckwalter
LicenseBSD3
Maintainerbjorn.buckwalter@gmail.com
StabilityStable
PortabilityGHC only?
Safe HaskellSafe
LanguageHaskell98

Numeric.NumType

Description

Please refer to the literate Haskell code for documentation of both API and implementation.

Documentation

class NumTypeI n => NumType n Source #

Instances

NumTypeI n => NumType n Source # 

class PosTypeI n => PosType n Source #

Instances

PosTypeI n => PosType n Source # 

class NegTypeI n => NegType n Source #

Instances

NegTypeI n => NegType n Source # 

class NonZeroI n => NonZero n Source #

Instances

NonZeroI n => NonZero n Source # 

class (NumTypeI a, NumTypeI b) => Succ a b | a -> b, b -> a Source #

Instances

Succ Zero (Pos Zero) Source # 
Succ (Neg Zero) Zero Source # 
NegTypeI a => Succ (Neg (Neg a)) (Neg a) Source # 
PosTypeI a => Succ (Pos a) (Pos (Pos a)) Source # 

class (NumTypeI a, NumTypeI b) => Negate a b | a -> b, b -> a Source #

Instances

Negate Zero Zero Source # 
(NegTypeI a, PosTypeI b, Negate a b) => Negate (Neg a) (Pos b) Source # 
(PosTypeI a, NegTypeI b, Negate a b) => Negate (Pos a) (Neg b) Source # 

class (Add a b c, Sub c b a) => Sum a b c | a b -> c, a c -> b, b c -> a Source #

Instances

(Add a b c, Sub c b a, Sub c a b) => Sum a b c Source # 

class (NumTypeI a, NonZeroI b, NumTypeI c) => Div a b c | a b -> c, c b -> a Source #

Instances

NonZeroI n => Div Zero n Zero Source # 
(NegTypeI n, Negate n p', Div (Pos p') (Pos p) (Pos p''), Negate (Pos p'') (Neg n''), PosTypeI p) => Div (Neg n) (Pos p) (Neg n'') Source # 
(NegTypeI n, NegTypeI n', Negate n p, Negate n' p', Div (Pos p) (Pos p') (Pos p''), PosTypeI p'') => Div (Neg n) (Neg n') (Pos p'') Source # 
(NegTypeI n, Negate n p', Div (Pos p) (Pos p') (Pos p''), Negate (Pos p'') (Neg n''), PosTypeI p) => Div (Pos p) (Neg n) (Neg n'') Source # 
(Sum n' (Pos n'') (Pos n), Div n'' (Pos n') n''', PosTypeI n''') => Div (Pos n) (Pos n') (Pos n''') Source # 

class (NumTypeI a, NumTypeI b, NumTypeI c) => Mul a b c | a b -> c Source #

Instances

NumTypeI n => Mul n Zero Zero Source # 
(NumTypeI a, NumTypeI c, NegTypeI n, Div c (Neg n) a) => Mul a (Neg n) c Source # 
(NumTypeI a, NumTypeI c, PosTypeI p, Div c (Pos p) a) => Mul a (Pos p) c Source # 

toNum :: (NumTypeI n, Num a) => n -> a Source #

incr :: Succ a b => a -> b Source #

decr :: Succ a b => b -> a Source #

negate :: Negate a b => a -> b Source #

(+) :: Sum a b c => a -> b -> c infixl 6 Source #

(-) :: Sum a b c => c -> b -> a infixl 6 Source #

(*) :: Mul a b c => a -> b -> c infixl 7 Source #

(/) :: Div a b c => a -> b -> c infixl 7 Source #

data Zero Source #

Instances

Show Zero Source # 

Methods

showsPrec :: Int -> Zero -> ShowS #

show :: Zero -> String #

showList :: [Zero] -> ShowS #

Negate Zero Zero Source # 
NumTypeI n => Mul n Zero Zero Source # 
NonZeroI n => Div Zero n Zero Source # 
Succ Zero (Pos Zero) Source # 
Succ (Neg Zero) Zero Source # 

data Pos n Source #

Instances

Succ Zero (Pos Zero) Source # 
(NumTypeI a, NumTypeI c, PosTypeI p, Div c (Pos p) a) => Mul a (Pos p) c Source # 
PosTypeI n => Show (Pos n) Source # 

Methods

showsPrec :: Int -> Pos n -> ShowS #

show :: Pos n -> String #

showList :: [Pos n] -> ShowS #

PosTypeI a => Succ (Pos a) (Pos (Pos a)) Source # 
(NegTypeI a, PosTypeI b, Negate a b) => Negate (Neg a) (Pos b) Source # 
(PosTypeI a, NegTypeI b, Negate a b) => Negate (Pos a) (Neg b) Source # 
(NegTypeI n, Negate n p', Div (Pos p') (Pos p) (Pos p''), Negate (Pos p'') (Neg n''), PosTypeI p) => Div (Neg n) (Pos p) (Neg n'') Source # 
(NegTypeI n, NegTypeI n', Negate n p, Negate n' p', Div (Pos p) (Pos p') (Pos p''), PosTypeI p'') => Div (Neg n) (Neg n') (Pos p'') Source # 
(NegTypeI n, Negate n p', Div (Pos p) (Pos p') (Pos p''), Negate (Pos p'') (Neg n''), PosTypeI p) => Div (Pos p) (Neg n) (Neg n'') Source # 
(Sum n' (Pos n'') (Pos n), Div n'' (Pos n') n''', PosTypeI n''') => Div (Pos n) (Pos n') (Pos n''') Source # 

data Neg n Source #

Instances

(NumTypeI a, NumTypeI c, NegTypeI n, Div c (Neg n) a) => Mul a (Neg n) c Source # 
NegTypeI n => Show (Neg n) Source # 

Methods

showsPrec :: Int -> Neg n -> ShowS #

show :: Neg n -> String #

showList :: [Neg n] -> ShowS #

Succ (Neg Zero) Zero Source # 
NegTypeI a => Succ (Neg (Neg a)) (Neg a) Source # 
(NegTypeI a, PosTypeI b, Negate a b) => Negate (Neg a) (Pos b) Source # 
(PosTypeI a, NegTypeI b, Negate a b) => Negate (Pos a) (Neg b) Source # 
(NegTypeI n, Negate n p', Div (Pos p') (Pos p) (Pos p''), Negate (Pos p'') (Neg n''), PosTypeI p) => Div (Neg n) (Pos p) (Neg n'') Source # 
(NegTypeI n, NegTypeI n', Negate n p, Negate n' p', Div (Pos p) (Pos p') (Pos p''), PosTypeI p'') => Div (Neg n) (Neg n') (Pos p'') Source # 
(NegTypeI n, Negate n p', Div (Pos p) (Pos p') (Pos p''), Negate (Pos p'') (Neg n''), PosTypeI p) => Div (Pos p) (Neg n) (Neg n'') Source #