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) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type Negate (Dec x)

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

type family IsPositive x #

Instances
type IsPositive (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type IsPositive (Dec x)

type family IsZero x #

Instances
type IsZero (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type IsZero (Dec x)

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

type family IsNegative x #

Instances
type IsNegative (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type IsNegative (Dec x)

type family IsNatural x #

Instances
type IsNatural (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type IsNatural (Dec x)

type family One repr #

Instances
type One Decimal # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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

type family Succ x #

Instances
type Succ (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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

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

type family Pred x #

Instances
type Pred (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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

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

type family IsEven x #

Instances
type IsEven (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type IsEven (Dec x) = IsEven x

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

type family IsOdd x #

Instances
type IsOdd x # 
Instance details

Defined in Type.Data.Num

type IsOdd x = Not (IsEven x)

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

type family x :+: y #

Instances
type (Un x) :+: (Un y) # 
Instance details

Defined in Type.Data.Num.Unary

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

Defined in Type.Data.Num.Decimal.Number

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) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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) # 
Instance details

Defined in Type.Data.Num.Unary

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

Defined in Type.Data.Num.Decimal.Number

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) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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

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

type family Pow2 x #

Instances
type Pow2 (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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

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

type family Log2Ceil x #

Instances
type Log2Ceil (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

type Div2 (Dec x)

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

type family Fac x #

Instances
type Fac x # 
Instance details

Defined in Type.Data.Num

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 # 
Instance details

Defined in Type.Data.Num.Unary

Methods

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

Representation Decimal # 
Instance details

Defined in Type.Data.Num.Decimal.Number

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) # 
Instance details

Defined in Type.Data.Num.Unary

Associated Types

type Repr (Un n) :: * #

Methods

singleton :: Singleton (Un n) #

Integer x => Integer (Dec x) # 
Instance details

Defined in Type.Data.Num.Decimal.Number

Associated Types

type Repr (Dec x) :: * #

Methods

singleton :: Singleton (Dec x) #

class Integer x => Natural x #

Instances
(Integer x, IsNatural x ~ True) => Natural x # 
Instance details

Defined in Type.Data.Num

class Integer x => Positive x #

Instances
(Integer x, IsPositive x ~ True) => Positive x # 
Instance details

Defined in Type.Data.Num

class Integer x => Negative x #

Instances
(Integer x, IsNegative x ~ True) => Negative x # 
Instance details

Defined in Type.Data.Num

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 #