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

Number.OccasionallyScalarExpression

Description

Physical expressions track the operations made on physical values so we are able to give detailed information on how to resolve unit violations.

Synopsis

# Documentation

data T a v Source #

A value of type T stores information on how to resolve unit violations. The main application of the module are certainly Number.Physical type instances but in principle it can also be applied to other occasionally scalar types.

Constructors

 Cons (Term a v) v
Instances
 (C a v, Show v) => C a (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression MethodstoScalar :: T a v -> a Source #toMaybeScalar :: T a v -> Maybe a Source #fromScalar :: a -> T a v Source # Eq v => Eq (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methods(==) :: T a v -> T a v -> Bool #(/=) :: T a v -> T a v -> Bool # Ord v => Ord (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methodscompare :: T a v -> T a v -> Ordering #(<) :: T a v -> T a v -> Bool #(<=) :: T a v -> T a v -> Bool #(>) :: T a v -> T a v -> Bool #(>=) :: T a v -> T a v -> Bool #max :: T a v -> T a v -> T a v #min :: T a v -> T a v -> T a v # Show v => Show (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression MethodsshowsPrec :: Int -> T a v -> ShowS #show :: T a v -> String #showList :: [T a v] -> ShowS # C v => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methodszero :: T a v Source #(+) :: T a v -> T a v -> T a v Source #(-) :: T a v -> T a v -> T a v Source #negate :: T a v -> T a v Source # C v => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression MethodsisZero :: T a v -> Bool Source # C v => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methods(*) :: T a v -> T a v -> T a v Source #one :: T a v Source #fromInteger :: Integer -> T a v Source #(^) :: T a v -> Integer -> T a v Source # C v => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methodsabs :: T a v -> T a v Source #signum :: T a v -> T a v Source # C v => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methods(/) :: T a v -> T a v -> T a v Source #recip :: T a v -> T a v Source #(^-) :: T a v -> Integer -> T a v Source # (C a, C v, Show v, C a v) => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methodssqrt :: T a v -> T a v Source #root :: Integer -> T a v -> T a v Source #(^/) :: T a v -> Rational -> T a v Source # (C a, C v, Show v, C a v) => C (T a v) Source # Instance detailsDefined in Number.OccasionallyScalarExpression Methodspi :: T a v Source #exp :: T a v -> T a v Source #log :: T a v -> T a v Source #logBase :: T a v -> T a v -> T a v Source #(**) :: T a v -> T a v -> T a v Source #sin :: T a v -> T a v Source #cos :: T a v -> T a v Source #tan :: T a v -> T a v Source #asin :: T a v -> T a v Source #acos :: T a v -> T a v Source #atan :: T a v -> T a v Source #sinh :: T a v -> T a v Source #cosh :: T a v -> T a v Source #tanh :: T a v -> T a v Source #asinh :: T a v -> T a v Source #acosh :: T a v -> T a v Source #atanh :: T a v -> T a v Source #

data Term a v Source #

Constructors

 Const Add (T a v) (T a v) Mul (T a v) (T a v) Div (T a v) (T a v)

fromValue :: v -> T a v Source #

showUnitError :: Show v => Bool -> Int -> v -> T a v -> String Source #

lift :: (v -> v) -> T a v -> T a v Source #

fromScalar :: (Show v, C a v) => a -> T a v Source #

scalarMap :: (Show v, C a v) => (a -> a) -> T a v -> T a v Source #

scalarMap2 :: (Show v, C a v) => (a -> a -> a) -> T a v -> T a v -> T a v Source #