numeric-prelude-0.4.2: An experimental alternative hierarchy of numeric type classes

Safe HaskellNone
LanguageHaskell98

Number.DimensionTerm

Contents

Description

Synopsis

Number type

newtype T u a Source

Constructors

Cons a 

Instances

(C u, C a b) => C a (T u b) 
(IsScalar u, C a b) => C a (T u b) 
Eq a => Eq (T u a) 
Ord a => Ord (T u a) 
(C u, Show a) => Show (T u a) 
NFData a => NFData (T u a) 
(C u, Random a) => Random (T u a) 
(C u, C a) => C (T u a) 
(IsScalar u, C a) => C (T u a) 
(IsScalar u, C a) => C (T u a) 

fromNumberWithDimension :: C u => u -> a -> T u a Source

toNumberWithDimension :: C u => u -> T u a -> a Source

(&*&) :: (C u, C v, C a) => T u a -> T v a -> T (Mul u v) a infixl 7 Source

(&/&) :: (C u, C v, C a) => T u a -> T v a -> T (Mul u (Recip v)) a infixl 7 Source

mulToScalar :: (C u, C a) => T u a -> T (Recip u) a -> a Source

divToScalar :: (C u, C a) => T u a -> T u a -> a Source

cancelToScalar :: C u => T (Mul u (Recip u)) a -> a Source

recip :: (C u, C a) => T u a -> T (Recip u) a Source

unrecip :: (C u, C a) => T (Recip u) a -> T u a Source

sqr :: (C u, C a) => T u a -> T (Sqr u) a Source

sqrt :: (C u, C a) => T (Sqr u) a -> T u a Source

abs :: (C u, C a) => T u a -> T u a Source

absSignum :: (C u, C a) => T u a -> (T u a, a) Source

scale :: (C u, C a) => a -> T u a -> T u a Source

(*&) :: (C u, C a) => a -> T u a -> T u a infixl 7 Source

rewriteDimension :: (C u, C v) => (u -> v) -> T u a -> T v a Source

Example constructors

type Scalar a = T Scalar a Source

type Length a = T Length a Source

type Time a = T Time a Source

type Mass a = T Mass a Source

type Charge a = T Charge a Source

type Angle a = T Angle a Source

type Voltage a = T Voltage a Source

scalar :: a -> Scalar a Source

length :: a -> Length a Source

time :: a -> Time a Source

mass :: a -> Mass a Source

charge :: a -> Charge a Source

angle :: a -> Angle a Source