tfp-1.0.0.2: Type-level integers, booleans, lists using type families

Safe HaskellSafe
LanguageHaskell2010

Type.Data.Num.Decimal.Number

Synopsis

Documentation

data Decimal #

Representation name for decimal type level numbers.

Instances

Representation Decimal # 

Methods

reifyIntegral :: Proxy Decimal -> Integer -> (forall s. (Integer s, (* ~ Repr s) Decimal) => Proxy s -> a) -> a #

type One Decimal # 

decimal :: Proxy n -> Proxy (Dec n) #

data Dec x #

The wrapper type for decimal type level numbers.

Instances

Integer x => Integer (Dec x) # 

Associated Types

type Repr (Dec x) :: * #

Methods

singleton :: Singleton (Dec x) #

(:/=:) x y => (Dec x) :/=: (Dec y) # 
(:==:) x y => (Dec x) :==: (Dec y) # 
(:>:) x y => (Dec x) :>: (Dec y) # 
(:>=:) x y => (Dec x) :>=: (Dec y) # 
(:<=:) x y => (Dec x) :<=: (Dec y) # 
(:<:) x y => (Dec x) :<: (Dec y) # 
type Repr (Dec x) # 
type Repr (Dec x) = Decimal
type Log2Ceil (Dec x) # 
type Log2Ceil (Dec x) = Dec (Log2Ceil x)
type Pow2 (Dec x) # 
type Pow2 (Dec x) = Dec (Pow2 x)
type Div2 (Dec x) # 
type Div2 (Dec x)
type Mul2 (Dec x) # 
type Mul2 (Dec x) = Dec ((:+:) x x)
type IsEven (Dec x) # 
type IsEven (Dec x) = IsEven x
type Pred (Dec x) # 
type Pred (Dec x) = Dec (Pred x)
type Succ (Dec x) # 
type Succ (Dec x) = Dec (Succ x)
type IsNatural (Dec x) # 
type IsNatural (Dec x)
type IsNegative (Dec x) # 
type IsNegative (Dec x)
type IsZero (Dec x) # 
type IsZero (Dec x)
type IsPositive (Dec x) # 
type IsPositive (Dec x)
type Negate (Dec x) # 
type Negate (Dec x)
type (Dec x) :*: (Dec y) # 
type (Dec x) :*: (Dec y) = Dec ((:*:) x y)
type (Dec x) :-: (Dec y) # 
type (Dec x) :-: (Dec y) = Dec ((:-:) x y)
type (Dec x) :+: (Dec y) # 
type (Dec x) :+: (Dec y) = Dec ((:+:) x y)
type Compare (Dec x) (Dec y) # 
type Compare (Dec x) (Dec y) = Compare x y

data Zero #

Instances

Natural Zero # 

Methods

switchNat :: f Zero -> (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f Zero #

Integer Zero # 

Methods

switch :: f Zero -> (forall x xs. (Pos x, Digits xs) => f (Neg x xs)) -> (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f Zero #

Zero :==: Zero # 
Zero :>=: Zero # 
Zero :<=: Zero # 
Zero :/=: (Pos y ys) # 
Zero :/=: (Neg y ys) # 
Zero :>: (Neg y ys) # 
Zero :>=: (Neg y ys) # 
Zero :<=: (Pos y ys) # 
Zero :<: (Pos y ys) # 
(Pos x xs) :/=: Zero # 
(Neg x xs) :/=: Zero # 
(Pos x xs) :>: Zero # 
(Pos x xs) :>=: Zero # 
(Neg x xs) :<=: Zero # 
(Neg x xs) :<: Zero # 
type ToUnary Zero # 
type Pow2 Zero # 
type Pow2 Zero
type IsEven Zero # 
type Pred Zero # 
type Succ Zero # 
type Succ Zero
type Compare Zero Zero # 
type Zero :*: _y # 
type Zero :*: _y = Zero
type Zero :+: y # 
type Zero :+: y = y
type Compare Zero (Pos _y _ys) # 
type Compare Zero (Pos _y _ys) = LT
type Compare Zero (Neg _y _ys) # 
type Compare Zero (Neg _y _ys) = GT
type Compare (Pos _x _xs) Zero # 
type Compare (Pos _x _xs) Zero = GT
type Compare (Neg _x _xs) Zero # 
type Compare (Neg _x _xs) Zero = LT
type (Pos _x _xs) :*: Zero # 
type (Pos _x _xs) :*: Zero = Zero
type (Neg _x _xs) :*: Zero # 
type (Neg _x _xs) :*: Zero = Zero
type (Pos x xs) :+: Zero # 
type (Pos x xs) :+: Zero = Pos x xs
type (Neg x xs) :+: Zero # 
type (Neg x xs) :+: Zero = Neg x xs

data Pos x xs #

Instances

Zero :/=: (Pos y ys) # 
Zero :<=: (Pos y ys) # 
Zero :<: (Pos y ys) # 
(Pos x, Digits xs) => Positive (Pos x xs) # 

Methods

switchPos :: (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Pos x xs) #

(Pos x, Digits xs) => Natural (Pos x xs) # 

Methods

switchNat :: f Zero -> (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Pos x xs) #

(Pos x, Digits xs) => Integer (Pos x xs) # 

Methods

switch :: f Zero -> (forall a xs0. (Pos a, Digits xs0) => f (Neg a xs0)) -> (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Pos x xs) #

(Pos x xs) :/=: Zero # 
(Pos x xs) :>: Zero # 
(Pos x xs) :>=: Zero # 
(~) * (IsEQ (ComparePos x xs y ys)) False => (Pos x xs) :/=: (Pos y ys) # 
(Pos x xs) :/=: (Neg y ys) # 
(Neg x xs) :/=: (Pos y ys) # 
(~) * (ComparePos x xs y ys) EQ => (Pos x xs) :==: (Pos y ys) # 
(~) * (ComparePos x xs y ys) GT => (Pos x xs) :>: (Pos y ys) # 
(Pos x xs) :>: (Neg y ys) # 
(~) * (GreaterPos y ys x xs) False => (Pos x xs) :>=: (Pos y ys) # 
(Pos x xs) :>=: (Neg y ys) # 
(~) * (GreaterPos x xs y ys) False => (Pos x xs) :<=: (Pos y ys) # 
(Neg x xs) :<=: (Pos y ys) # 
(~) * (ComparePos x xs y ys) LT => (Pos x xs) :<: (Pos y ys) # 
(Neg x xs) :<: (Pos y ys) # 
type Compare Zero (Pos _y _ys) # 
type Compare Zero (Pos _y _ys) = LT
type ToUnary (Pos x xs) # 
type ToUnary (Pos x xs) = ToUnaryAcc (ToUnary x) xs
type Log2Ceil (Pos x xs) # 
type Log2Ceil (Pos x xs)
type Pow2 (Pos x xs) # 
type Pow2 (Pos x xs)
type IsEven (Pos x xs) # 
type IsEven (Pos x xs)
type Pred (Pos x xs) # 
type Pred (Pos x xs)
type Succ (Pos x xs) # 
type Succ (Pos x xs)
type Compare (Pos _x _xs) Zero # 
type Compare (Pos _x _xs) Zero = GT
type (Pos _x _xs) :*: Zero # 
type (Pos _x _xs) :*: Zero = Zero
type (Pos x xs) :+: Zero # 
type (Pos x xs) :+: Zero = Pos x xs
type Compare (Pos _x _xs) (Neg _y _ys) # 
type Compare (Pos _x _xs) (Neg _y _ys) = GT
type Compare (Pos x xs) (Pos y ys) # 
type Compare (Pos x xs) (Pos y ys)
type Compare (Neg _x _xs) (Pos _y _ys) # 
type Compare (Neg _x _xs) (Pos _y _ys) = LT
type (Pos x xs) :*: (Neg y ys) # 
type (Pos x xs) :*: (Neg y ys)
type (Pos x xs) :*: (Pos y ys) # 
type (Pos x xs) :*: (Pos y ys)
type (Neg x xs) :*: (Pos y ys) # 
type (Neg x xs) :*: (Pos y ys)
type (Pos x xs) :+: (Pos y ys) # 
type (Pos x xs) :+: (Pos y ys)
type (Pos x xs) :+: (Neg y ys) # 
type (Pos x xs) :+: (Neg y ys)
type (Neg x xs) :+: (Pos y ys) # 
type (Neg x xs) :+: (Pos y ys)

data Neg x xs #

Instances

Zero :/=: (Neg y ys) # 
Zero :>: (Neg y ys) # 
Zero :>=: (Neg y ys) # 
(Pos x, Digits xs) => Negative (Neg x xs) # 

Methods

switchNeg :: (forall a xs0. (Pos a, Digits xs0) => f (Neg a xs0)) -> f (Neg x xs) #

(Pos x, Digits xs) => Integer (Neg x xs) # 

Methods

switch :: f Zero -> (forall a xs0. (Pos a, Digits xs0) => f (Neg a xs0)) -> (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Neg x xs) #

(Neg x xs) :/=: Zero # 
(Neg x xs) :<=: Zero # 
(Neg x xs) :<: Zero # 
(Pos x xs) :/=: (Neg y ys) # 
(~) * (IsEQ (ComparePos x xs y ys)) False => (Neg x xs) :/=: (Neg y ys) # 
(Neg x xs) :/=: (Pos y ys) # 
(~) * (ComparePos x xs y ys) EQ => (Neg x xs) :==: (Neg y ys) # 
(Pos x xs) :>: (Neg y ys) # 
(~) * (ComparePos x xs y ys) LT => (Neg x xs) :>: (Neg y ys) # 
(Pos x xs) :>=: (Neg y ys) # 
(~) * (GreaterPos x xs y ys) False => (Neg x xs) :>=: (Neg y ys) # 
(~) * (GreaterPos y ys x xs) False => (Neg x xs) :<=: (Neg y ys) # 
(Neg x xs) :<=: (Pos y ys) # 
(~) * (ComparePos x xs y ys) GT => (Neg x xs) :<: (Neg y ys) # 
(Neg x xs) :<: (Pos y ys) # 
type Compare Zero (Neg _y _ys) # 
type Compare Zero (Neg _y _ys) = GT
type IsEven (Neg x xs) # 
type IsEven (Neg x xs)
type Pred (Neg x xs) # 
type Pred (Neg x xs)
type Succ (Neg x xs) # 
type Succ (Neg x xs)
type Compare (Neg _x _xs) Zero # 
type Compare (Neg _x _xs) Zero = LT
type (Neg _x _xs) :*: Zero # 
type (Neg _x _xs) :*: Zero = Zero
type (Neg x xs) :+: Zero # 
type (Neg x xs) :+: Zero = Neg x xs
type Compare (Pos _x _xs) (Neg _y _ys) # 
type Compare (Pos _x _xs) (Neg _y _ys) = GT
type Compare (Neg _x _xs) (Pos _y _ys) # 
type Compare (Neg _x _xs) (Pos _y _ys) = LT
type Compare (Neg x xs) (Neg y ys) # 
type Compare (Neg x xs) (Neg y ys)
type (Pos x xs) :*: (Neg y ys) # 
type (Pos x xs) :*: (Neg y ys)
type (Neg x xs) :*: (Pos y ys) # 
type (Neg x xs) :*: (Pos y ys)
type (Neg x xs) :*: (Neg y ys) # 
type (Neg x xs) :*: (Neg y ys)
type (Pos x xs) :+: (Neg y ys) # 
type (Pos x xs) :+: (Neg y ys)
type (Neg x xs) :+: (Neg y ys) # 
type (Neg x xs) :+: (Neg y ys)
type (Neg x xs) :+: (Pos y ys) # 
type (Neg x xs) :+: (Pos y ys)

data EndAsc #

The terminator type for ascending decimal digit lists.

Instances

data ds :< d infixl 9 #

data EndDesc #

The terminator type for descending decimal digit lists.

Instances

Show EndDesc # 
Digits EndDesc # 

Methods

switchDigits :: f EndDesc -> (forall xh xl. (C xh, Digits xl) => f (xh :> xl)) -> f EndDesc #

type ToUnaryAcc m EndDesc # 
type ToUnaryAcc m EndDesc = m

data d :> ds infixr 9 #

Instances

(C xh, Digits xl) => Digits ((:>) xh xl) # 

Methods

switchDigits :: f EndDesc -> (forall xh0 xl0. (C xh0, Digits xl0) => f (xh0 :> xl0)) -> f (xh :> xl) #

type ToUnaryAcc m ((:>) x xs) # 
type ToUnaryAcc m ((:>) x xs) = ToUnaryAcc (UnaryAcc m x) xs

newtype Singleton x #

Constructors

Singleton Integer 

integralFromProxy :: (Integer n, Num a) => Proxy n -> a #

class Integer n where #

Minimal complete definition

switch

Methods

switch :: f Zero -> (forall x xs. (Pos x, Digits xs) => f (Neg x xs)) -> (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f n #

Instances

Integer Zero # 

Methods

switch :: f Zero -> (forall x xs. (Pos x, Digits xs) => f (Neg x xs)) -> (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f Zero #

(Pos x, Digits xs) => Integer (Pos x xs) # 

Methods

switch :: f Zero -> (forall a xs0. (Pos a, Digits xs0) => f (Neg a xs0)) -> (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Pos x xs) #

(Pos x, Digits xs) => Integer (Neg x xs) # 

Methods

switch :: f Zero -> (forall a xs0. (Pos a, Digits xs0) => f (Neg a xs0)) -> (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Neg x xs) #

class Integer n => Natural n where #

Minimal complete definition

switchNat

Methods

switchNat :: f Zero -> (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f n #

Instances

Natural Zero # 

Methods

switchNat :: f Zero -> (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f Zero #

(Pos x, Digits xs) => Natural (Pos x xs) # 

Methods

switchNat :: f Zero -> (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Pos x xs) #

class Natural n => Positive n where #

Minimal complete definition

switchPos

Methods

switchPos :: (forall x xs. (Pos x, Digits xs) => f (Pos x xs)) -> f n #

Instances

(Pos x, Digits xs) => Positive (Pos x xs) # 

Methods

switchPos :: (forall a xs0. (Pos a, Digits xs0) => f (Pos a xs0)) -> f (Pos x xs) #

class Integer n => Negative n where #

Minimal complete definition

switchNeg

Methods

switchNeg :: (forall x xs. (Pos x, Digits xs) => f (Neg x xs)) -> f n #

Instances

(Pos x, Digits xs) => Negative (Neg x xs) # 

Methods

switchNeg :: (forall a xs0. (Pos a, Digits xs0) => f (Neg a xs0)) -> f (Neg x xs) #

reifyIntegral :: Integer -> (forall s. Integer s => Proxy s -> w) -> w #

reifyNatural :: Integer -> (forall s. Natural s => Proxy s -> a) -> Maybe a #

reifyPositive :: Integer -> (forall s. Positive s => Proxy s -> a) -> Maybe a #

reifyNegative :: Integer -> (forall s. Negative s => Proxy s -> a) -> Maybe a #

reifyPos :: Integer -> (forall x xs. (Pos x, Digits xs) => Proxy (Pos x xs) -> a) -> Maybe a #

reifyNeg :: Integer -> (forall x xs. (Pos x, Digits xs) => Proxy (Neg x xs) -> a) -> Maybe a #

class Digits xs where #

Minimal complete definition

switchDigits

Methods

switchDigits :: f EndDesc -> (forall xh xl. (C xh, Digits xl) => f (xh :> xl)) -> f xs #

Instances

Digits EndDesc # 

Methods

switchDigits :: f EndDesc -> (forall xh xl. (C xh, Digits xl) => f (xh :> xl)) -> f EndDesc #

(C xh, Digits xl) => Digits ((:>) xh xl) # 

Methods

switchDigits :: f EndDesc -> (forall xh0 xl0. (C xh0, Digits xl0) => f (xh0 :> xl0)) -> f (xh :> xl) #

type family x :+: y #

Instances

type Zero :+: y # 
type Zero :+: y = y
type (Pos x xs) :+: Zero # 
type (Pos x xs) :+: Zero = Pos x xs
type (Neg x xs) :+: Zero # 
type (Neg x xs) :+: Zero = Neg x xs
type (Pos x xs) :+: (Pos y ys) # 
type (Pos x xs) :+: (Pos y ys)
type (Pos x xs) :+: (Neg y ys) # 
type (Pos x xs) :+: (Neg y ys)
type (Neg x xs) :+: (Neg y ys) # 
type (Neg x xs) :+: (Neg y ys)
type (Neg x xs) :+: (Pos y ys) # 
type (Neg x xs) :+: (Pos y ys)

type (:-:) x y = x :+: Negate y #

type family x :*: y #

Instances

type Zero :*: _y # 
type Zero :*: _y = Zero
type (Pos _x _xs) :*: Zero # 
type (Pos _x _xs) :*: Zero = Zero
type (Neg _x _xs) :*: Zero # 
type (Neg _x _xs) :*: Zero = Zero
type (Pos x xs) :*: (Neg y ys) # 
type (Pos x xs) :*: (Neg y ys)
type (Pos x xs) :*: (Pos y ys) # 
type (Pos x xs) :*: (Pos y ys)
type (Neg x xs) :*: (Pos y ys) # 
type (Neg x xs) :*: (Pos y ys)
type (Neg x xs) :*: (Neg y ys) # 
type (Neg x xs) :*: (Neg y ys)

type family Pred x #

Instances

type Pred Zero # 
type Pred (Pos x xs) # 
type Pred (Pos x xs)
type Pred (Neg x xs) # 
type Pred (Neg x xs)

type family Succ x #

Instances

type Succ Zero # 
type Succ Zero
type Succ (Pos x xs) # 
type Succ (Pos x xs)
type Succ (Neg x xs) # 
type Succ (Neg x xs)

type family Compare x y #

Instances

type Compare Zero Zero # 
type Compare Zero (Pos _y _ys) # 
type Compare Zero (Pos _y _ys) = LT
type Compare Zero (Neg _y _ys) # 
type Compare Zero (Neg _y _ys) = GT
type Compare (Pos _x _xs) Zero # 
type Compare (Pos _x _xs) Zero = GT
type Compare (Neg _x _xs) Zero # 
type Compare (Neg _x _xs) Zero = LT
type Compare (Pos _x _xs) (Neg _y _ys) # 
type Compare (Pos _x _xs) (Neg _y _ys) = GT
type Compare (Pos x xs) (Pos y ys) # 
type Compare (Pos x xs) (Pos y ys)
type Compare (Neg _x _xs) (Pos _y _ys) # 
type Compare (Neg _x _xs) (Pos _y _ys) = LT
type Compare (Neg x xs) (Neg y ys) # 
type Compare (Neg x xs) (Neg y ys)

type family IsEven x #

Instances

type IsEven Zero # 
type IsEven (Pos x xs) # 
type IsEven (Pos x xs)
type IsEven (Neg x xs) # 
type IsEven (Neg x xs)

type family Pow2 x #

Instances

type Pow2 Zero # 
type Pow2 Zero
type Pow2 (Pos x xs) # 
type Pow2 (Pos x xs)

type family Log2Ceil x #

Instances

type Log2Ceil (Pos x xs) # 
type Log2Ceil (Pos x xs)

class x :<: y #

Instances

Zero :<: (Pos y ys) # 
(:<:) x y => (Dec x) :<: (Dec y) # 
(Neg x xs) :<: Zero # 
(~) * (ComparePos x xs y ys) LT => (Pos x xs) :<: (Pos y ys) # 
(~) * (ComparePos x xs y ys) GT => (Neg x xs) :<: (Neg y ys) # 
(Neg x xs) :<: (Pos y ys) # 

class x :<=: y #

Instances

Zero :<=: Zero # 
Zero :<=: (Pos y ys) # 
(:<=:) x y => (Dec x) :<=: (Dec y) # 
(Neg x xs) :<=: Zero # 
(~) * (GreaterPos x xs y ys) False => (Pos x xs) :<=: (Pos y ys) # 
(~) * (GreaterPos y ys x xs) False => (Neg x xs) :<=: (Neg y ys) # 
(Neg x xs) :<=: (Pos y ys) # 

class x :==: y #

Instances

Zero :==: Zero # 
(:==:) x y => (Dec x) :==: (Dec y) # 
(~) * (ComparePos x xs y ys) EQ => (Pos x xs) :==: (Pos y ys) # 
(~) * (ComparePos x xs y ys) EQ => (Neg x xs) :==: (Neg y ys) # 

class x :>: y #

Instances

Zero :>: (Neg y ys) # 
(:>:) x y => (Dec x) :>: (Dec y) # 
(Pos x xs) :>: Zero # 
(~) * (ComparePos x xs y ys) GT => (Pos x xs) :>: (Pos y ys) # 
(Pos x xs) :>: (Neg y ys) # 
(~) * (ComparePos x xs y ys) LT => (Neg x xs) :>: (Neg y ys) # 

class x :>=: y #

Instances

Zero :>=: Zero # 
Zero :>=: (Neg y ys) # 
(:>=:) x y => (Dec x) :>=: (Dec y) # 
(Pos x xs) :>=: Zero # 
(~) * (GreaterPos y ys x xs) False => (Pos x xs) :>=: (Pos y ys) # 
(Pos x xs) :>=: (Neg y ys) # 
(~) * (GreaterPos x xs y ys) False => (Neg x xs) :>=: (Neg y ys) # 

class x :/=: y #

Instances

Zero :/=: (Pos y ys) # 
Zero :/=: (Neg y ys) # 
(:/=:) x y => (Dec x) :/=: (Dec y) # 
(Pos x xs) :/=: Zero # 
(Neg x xs) :/=: Zero # 
(~) * (IsEQ (ComparePos x xs y ys)) False => (Pos x xs) :/=: (Pos y ys) # 
(Pos x xs) :/=: (Neg y ys) # 
(~) * (IsEQ (ComparePos x xs y ys)) False => (Neg x xs) :/=: (Neg y ys) # 
(Neg x xs) :/=: (Pos y ys) # 

type family FromUnary n #

Instances

type FromUnary Zero # 
type FromUnary (Succ n) # 
type FromUnary (Succ n) = Succ (FromUnary n)

type family ToUnary n #

Instances

type ToUnary Zero # 
type ToUnary (Pos x xs) # 
type ToUnary (Pos x xs) = ToUnaryAcc (ToUnary x) xs

type family ToUnaryAcc m n #

Instances

type ToUnaryAcc m EndDesc # 
type ToUnaryAcc m EndDesc = m
type ToUnaryAcc m ((:>) x xs) # 
type ToUnaryAcc m ((:>) x xs) = ToUnaryAcc (UnaryAcc m x) xs

type UnaryAcc m x = ToUnary x :+: (m :*: U10) #