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

Safe HaskellNone
LanguageHaskell98

Number.Physical

Description

Numeric values combined with abstract Physical Units

Synopsis

Documentation

data T i a Source #

A Physics.Quantity.Value.T combines a numeric value with a physical unit.

Constructors

Cons (T i) a 
Instances
(Ord i, C a v) => C a (T i v) Source # 
Instance details

Defined in Number.Physical

Methods

(*>) :: a -> T i v -> T i v Source #

(Ord i, C a v) => C a (T i v) Source # 
Instance details

Defined in Number.Physical

C a v => C a (T i v) Source # 
Instance details

Defined in Number.Physical

Methods

toScalar :: T i v -> a Source #

toMaybeScalar :: T i v -> Maybe a Source #

fromScalar :: a -> T i v Source #

Monad (T i) Source # 
Instance details

Defined in Number.Physical

Methods

(>>=) :: T i a -> (a -> T i b) -> T i b #

(>>) :: T i a -> T i b -> T i b #

return :: a -> T i a #

fail :: String -> T i a #

Functor (T i) Source # 
Instance details

Defined in Number.Physical

Methods

fmap :: (a -> b) -> T i a -> T i b #

(<$) :: a -> T i b -> T i a #

Applicative (T a) Source # 
Instance details

Defined in Number.Physical

Methods

pure :: a0 -> T a a0 #

(<*>) :: T a (a0 -> b) -> T a a0 -> T a b #

liftA2 :: (a0 -> b -> c) -> T a a0 -> T a b -> T a c #

(*>) :: T a a0 -> T a b -> T a b #

(<*) :: T a a0 -> T a b -> T a a0 #

Ord i => C (T i) Source # 
Instance details

Defined in Number.Physical

Methods

zero :: C a => T i a Source #

(<+>) :: C a => T i a -> T i a -> T i a Source #

(*>) :: C a => a -> T i a -> T i a Source #

(Eq i, Eq a) => Eq (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

(==) :: T i a -> T i a -> Bool #

(/=) :: T i a -> T i a -> Bool #

(Ord i, Ord a) => Ord (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

compare :: T i a -> T i a -> Ordering #

(<) :: T i a -> T i a -> Bool #

(<=) :: T i a -> T i a -> Bool #

(>) :: T i a -> T i a -> Bool #

(>=) :: T i a -> T i a -> Bool #

max :: T i a -> T i a -> T i a #

min :: T i a -> T i a -> T i a #

(Ord i, Enum i, Show a) => Show (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

showsPrec :: Int -> T i a -> ShowS #

show :: T i a -> String #

showList :: [T i a] -> ShowS #

(Ord i, C a) => C (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

zero :: T i a Source #

(+) :: T i a -> T i a -> T i a Source #

(-) :: T i a -> T i a -> T i a Source #

negate :: T i a -> T i a Source #

C v => C (T a v) Source # 
Instance details

Defined in Number.Physical

Methods

isZero :: T a v -> Bool Source #

(Ord i, C a) => C (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

(*) :: T i a -> T i a -> T i a Source #

one :: T i a Source #

fromInteger :: Integer -> T i a Source #

(^) :: T i a -> Integer -> T i a Source #

(Ord i, C a) => C (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

abs :: T i a -> T i a Source #

signum :: T i a -> T i a Source #

(Ord i, C a) => C (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

(/) :: T i a -> T i a -> T i a Source #

recip :: T i a -> T i a Source #

fromRational' :: Rational -> T i a Source #

(^-) :: T i a -> Integer -> T i a Source #

(Ord i, C a) => C (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

sqrt :: T i a -> T i a Source #

root :: Integer -> T i a -> T i a Source #

(^/) :: T i a -> Rational -> T i a Source #

(Ord i, C a) => C (T i a) Source # 
Instance details

Defined in Number.Physical

Methods

pi :: T i a Source #

exp :: T i a -> T i a Source #

log :: T i a -> T i a Source #

logBase :: T i a -> T i a -> T i a Source #

(**) :: T i a -> T i a -> T i a Source #

sin :: T i a -> T i a Source #

cos :: T i a -> T i a Source #

tan :: T i a -> T i a Source #

asin :: T i a -> T i a Source #

acos :: T i a -> T i a Source #

atan :: T i a -> T i a Source #

sinh :: T i a -> T i a Source #

cosh :: T i a -> T i a Source #

tanh :: T i a -> T i a Source #

asinh :: T i a -> T i a Source #

acosh :: T i a -> T i a Source #

atanh :: T i a -> T i a Source #

quantity :: (Ord i, Enum i, C a) => [Int] -> a -> T i a Source #

Construct a physical value from a numeric value and the full vector representation of a unit.

isScalar :: T i a -> Bool Source #

Test for the neutral Unit.T. Also a zero has a unit!

lift :: (a -> b) -> T i a -> T i b Source #

apply a function to the numeric value while preserving the unit

lift2 :: Eq i => String -> (a -> b -> c) -> T i a -> T i b -> T i c Source #

lift2Maybe :: Eq i => (a -> b -> c) -> T i a -> T i b -> Maybe (T i c) Source #

lift2Gen :: Eq i => String -> (a -> b -> c) -> T i a -> T i b -> c Source #

addMaybe :: (Eq i, C a) => T i a -> T i a -> Maybe (T i a) Source #

Add two values if the units match, otherwise return Nothing

subMaybe :: (Eq i, C a) => T i a -> T i a -> Maybe (T i a) Source #

Subtract two values if the units match, otherwise return Nothing

scale :: (Ord i, C a) => a -> T i a -> T i a Source #

ratPow :: C a => T Int -> T i a -> T i a Source #

ratPowMaybe :: C a => T Int -> T i a -> Maybe (T i a) Source #

fromRatio :: (C b, C a) => T a -> b Source #