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

Safe HaskellSafe
LanguageHaskell2010

Type.Data.Num

Synopsis

Documentation

type family Negate x #

Negate x evaluates to the additive inverse of (i.e., minus) x.

Instances

type Negate (Dec x) # 
type Negate (Dec x)

negate :: Proxy x -> Proxy (Negate x) #

type family IsPositive x #

Instances

type IsPositive (Dec x) # 
type IsPositive (Dec x)

type family IsZero x #

Instances

type IsZero (Dec x) # 
type IsZero (Dec x)

isZero :: Proxy x -> Proxy (IsZero x) #

type family IsNegative x #

Instances

type IsNegative (Dec x) # 
type IsNegative (Dec x)

type family IsNatural x #

Instances

type IsNatural (Dec x) # 
type IsNatural (Dec x)

type family One repr #

Instances

type One Decimal # 

one :: Proxy repr -> Proxy (One repr) #

type family Succ x #

Instances

type Succ (Dec x) # 
type Succ (Dec x) = Dec (Succ x)

succ :: Proxy x -> Proxy (Succ x) #

type family Pred x #

Instances

type Pred (Dec x) # 
type Pred (Dec x) = Dec (Pred x)

pred :: Proxy x -> Proxy (Pred x) #

type family IsEven x #

Instances

type IsEven (Dec x) # 
type IsEven (Dec x) = IsEven x

isEven :: Proxy x -> Proxy (IsEven x) #

type family IsOdd x #

Instances

type IsOdd x # 
type IsOdd x = Not (IsEven x)

isOdd :: Proxy x -> Proxy (IsOdd x) #

type family x :+: y #

Instances

type (Un x) :+: (Un y) # 
type (Un x) :+: (Un y) = Un ((:+:) x y)
type (Dec x) :+: (Dec y) # 
type (Dec x) :+: (Dec y) = Dec ((:+:) x y)

add :: Proxy x -> Proxy y -> Proxy (x :+: y) #

type family x :-: y #

Instances

type (Dec x) :-: (Dec y) # 
type (Dec x) :-: (Dec y) = Dec ((:-:) x y)

sub :: Proxy x -> Proxy y -> Proxy (x :-: y) #

type family x :*: y #

Instances

type (Un x) :*: (Un y) # 
type (Un x) :*: (Un y) = Un ((:*:) x y)
type (Dec x) :*: (Dec y) # 
type (Dec x) :*: (Dec y) = Dec ((:*:) x y)

mul :: Proxy x -> Proxy y -> Proxy (x :*: y) #

type family Mul2 x #

Instances

type Mul2 (Dec x) # 
type Mul2 (Dec x) = Dec ((:+:) x x)

mul2 :: Proxy x -> Proxy (Mul2 x) #

type family Pow2 x #

Instances

type Pow2 (Dec x) # 
type Pow2 (Dec x) = Dec (Pow2 x)

pow2 :: Proxy x -> Proxy (Pow2 x) #

type family Log2Ceil x #

Instances

type Log2Ceil (Dec x) # 
type Log2Ceil (Dec x) = Dec (Log2Ceil x)

type family DivMod x y #

divMod :: Proxy x -> Proxy y -> Proxy (DivMod x y) #

type family Div x y #

div :: Proxy x -> Proxy y -> Proxy (Div x y) #

type family Mod x y #

mod :: Proxy x -> Proxy y -> Proxy (Mod x y) #

type family Div2 x #

Instances

type Div2 (Dec x) # 
type Div2 (Dec x)

div2 :: Proxy x -> Proxy (Div2 x) #

type family Fac x #

Instances

type Fac x # 
type Fac x

fac :: Proxy x -> Proxy (Fac x) #

newtype Singleton d #

Constructors

Singleton Integer 

class Representation r where #

Minimal complete definition

reifyIntegral

Methods

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

Instances

Representation Unary # 

Methods

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

Representation Decimal # 

Methods

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

class Representation (Repr x) => Integer x where #

Minimal complete definition

singleton

Associated Types

type Repr x #

Methods

singleton :: Singleton x #

Instances

Natural n => Integer (Un n) # 

Associated Types

type Repr (Un n) :: * #

Methods

singleton :: Singleton (Un n) #

Integer x => Integer (Dec x) # 

Associated Types

type Repr (Dec x) :: * #

Methods

singleton :: Singleton (Dec x) #

class Integer x => Natural x #

Instances

(Integer x, (~) * (IsNatural x) True) => Natural x # 

class Integer x => Positive x #

Instances

(Integer x, (~) * (IsPositive x) True) => Positive x # 

class Integer x => Negative x #

Instances

(Integer x, (~) * (IsNegative x) True) => Negative x # 

fromInteger :: forall x y. (Integer x, Num y) => Proxy x -> y #

reifyPositive :: Representation r => Proxy r -> Integer -> (forall s. (Positive s, Repr s ~ r) => Proxy s -> a) -> Maybe a #

reifyNegative :: Representation r => Proxy r -> Integer -> (forall s. (Negative s, Repr s ~ r) => Proxy s -> a) -> Maybe a #

reifyNatural :: Representation r => Proxy r -> Integer -> (forall s. (Natural s, Repr s ~ r) => Proxy s -> a) -> Maybe a #