-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Type-level (low cardinality) integers.
--   
--   This package provides unary type level representations of the
--   (positive and negative) integers and basic operations (addition,
--   subtraction, multiplication, division) on these. Due to the unary
--   implementation the practical size of the NumTypes is severely limited
--   making them unsuitable for large-cardinality applications. If you will
--   be working with integers beyond (-20, 20) this package probably isn't
--   for you. It is, however, eminently suitable for applications such as
--   representing physical dimensions (see the <a>Dimensional</a> library).
--   Requires GHC 6.6.1 or later.
@package numtype
@version 1.0


-- | Please refer to the literate Haskell code for documentation of both
--   API and implementation.
module Numeric.NumType
class NumTypeI n => NumType n
class PosTypeI n => PosType n
class NegTypeI n => NegType n
class NonZeroI n => NonZero n
class (NumTypeI a, NumTypeI b) => Succ a b | a -> b, b -> a
class (NumTypeI a, NumTypeI b) => Negate a b | a -> b, b -> a
class (Add a b c, Sub c b a) => Sum a b c | a b -> c, a c -> b, b c -> a
class (NumTypeI a, NonZeroI b, NumTypeI c) => Div a b c | a b -> c, c b -> a
class (NumTypeI a, NumTypeI b, NumTypeI c) => Mul a b c | a b -> c
toNum :: (NumTypeI n, Num a) => n -> a
incr :: Succ a b => a -> b
decr :: Succ a b => b -> a
negate :: Negate a b => a -> b
(+) :: Sum a b c => a -> b -> c
(-) :: Sum a b c => c -> b -> a
(*) :: Mul a b c => a -> b -> c
(/) :: Div a b c => a -> b -> c
data Zero
data Pos n
data Neg n
type Pos1 = Pos Zero
type Pos2 = Pos Pos1
type Pos3 = Pos Pos2
type Pos4 = Pos Pos3
type Pos5 = Pos Pos4
type Neg1 = Neg Zero
type Neg2 = Neg Neg1
type Neg3 = Neg Neg2
type Neg4 = Neg Neg3
type Neg5 = Neg Neg4
zero :: Zero
pos1 :: Pos1
pos2 :: Pos2
pos3 :: Pos3
pos4 :: Pos4
pos5 :: Pos5
neg1 :: Neg1
neg2 :: Neg2
neg3 :: Neg3
neg4 :: Neg4
neg5 :: Neg5
instance (NegTypeI n, Div c (Neg n) a) => Mul a (Neg n) c
instance (PosTypeI p, Div c (Pos p) a) => Mul a (Pos p) c
instance NumTypeI n => Mul n Zero Zero
instance (NegTypeI n, Negate n p', Div (Pos p') (Pos p) (Pos p''), Negate (Pos p'') (Neg n'')) => Div (Neg n) (Pos p) (Neg n'')
instance (NegTypeI n, Negate n p', Div (Pos p) (Pos p') (Pos p''), Negate (Pos p'') (Neg n'')) => Div (Pos p) (Neg n) (Neg n'')
instance (NegTypeI n, NegTypeI n', Negate n p, Negate n' p', Div (Pos p) (Pos p') (Pos p'')) => Div (Neg n) (Neg n') (Pos p'')
instance (Sum n' (Pos n'') (Pos n), Div n'' (Pos n') n''', PosTypeI n''') => Div (Pos n) (Pos n') (Pos n''')
instance NonZeroI n => Div Zero n Zero
instance (Add a b c, Sub c b a) => Sum a b c
instance (Succ a a', NegTypeI b, Sub a' b c) => Sub a (Neg b) c
instance (Succ a' a, PosTypeI b, Sub a' b c) => Sub a (Pos b) c
instance NumType a => Sub a Zero a
instance (NegTypeI a, Succ c b, Add a c d) => Add (Neg a) b d
instance (PosTypeI a, Succ b c, Add a c d) => Add (Pos a) b d
instance NumTypeI a => Add Zero a a
instance NegTypeI a => Succ (Neg (Neg a)) (Neg a)
instance Succ (Neg Zero) Zero
instance PosTypeI a => Succ (Pos a) (Pos (Pos a))
instance Succ Zero (Pos Zero)
instance (NegTypeI a, PosTypeI b, Negate a b) => Negate (Neg a) (Pos b)
instance (PosTypeI a, NegTypeI b, Negate a b) => Negate (Pos a) (Neg b)
instance Negate Zero Zero
instance NegTypeI n => Show (Neg n)
instance PosTypeI n => Show (Pos n)
instance Show Zero
instance NegTypeI n => NonZeroI (Neg n)
instance NegTypeI n => NegTypeI (Neg n)
instance NegTypeI n => NumTypeI (Neg n)
instance PosTypeI n => NonZeroI (Pos n)
instance PosTypeI n => PosTypeI (Pos n)
instance PosTypeI n => NumTypeI (Pos n)
instance NegTypeI Zero
instance PosTypeI Zero
instance NumTypeI Zero
instance NonZeroI n => NonZero n
instance NegTypeI n => NegType n
instance PosTypeI n => PosType n
instance NumTypeI n => NumType n
