{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Number.SI where
import qualified Number.SI.Unit as SIUnit
import Number.SI.Unit (Dimension, bytesize)
import qualified Number.Physical as Value
import qualified Number.Physical.Unit as Unit
import qualified Number.Physical.Show as PVShow
import qualified Number.Physical.Read as PVRead
import qualified Number.Physical.UnitDatabase as UnitDatabase
import Algebra.OccasionallyScalar as OccScalar
import qualified Algebra.NormedSpace.Maximum as NormedMax
import qualified Algebra.VectorSpace as VectorSpace
import qualified Algebra.Module as Module
import qualified Algebra.Vector as Vector
import qualified Algebra.Transcendental as Trans
import qualified Algebra.Algebraic as Algebraic
import qualified Algebra.Field as Field
import qualified Algebra.Absolute as Absolute
import qualified Algebra.Ring as Ring
import qualified Algebra.Additive as Additive
import qualified Algebra.ZeroTestable as ZeroTestable
import Data.Tuple.HT (mapFst, )
import qualified MathObj.Wrapper.Haskell98 as W98
import qualified Prelude as P
import NumericPrelude.Numeric
import NumericPrelude.Base
newtype T a v = Cons (PValue v)
deriving (a -> T a b -> T a a
(a -> b) -> T a a -> T a b
(forall a b. (a -> b) -> T a a -> T a b)
-> (forall a b. a -> T a b -> T a a) -> Functor (T a)
forall a b. a -> T a b -> T a a
forall a b. (a -> b) -> T a a -> T a b
forall a a b. a -> T a b -> T a a
forall a a b. (a -> b) -> T a a -> T a b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> T a b -> T a a
$c<$ :: forall a a b. a -> T a b -> T a a
fmap :: (a -> b) -> T a a -> T a b
$cfmap :: forall a a b. (a -> b) -> T a a -> T a b
Functor)
type PValue v = Value.T Dimension v
lift :: (PValue v0 -> PValue v1) ->
(T a v0 -> T a v1)
lift :: (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v0 -> PValue v1
f (Cons PValue v0
x) = (PValue v1 -> T a v1
forall a v. PValue v -> T a v
Cons (PValue v0 -> PValue v1
f PValue v0
x))
lift2 :: (PValue v0 -> PValue v1 -> PValue v2) ->
(T a v0 -> T a v1 -> T a v2)
lift2 :: (PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v0 -> PValue v1 -> PValue v2
f (Cons PValue v0
x) (Cons PValue v1
y) = (PValue v2 -> T a v2
forall a v. PValue v -> T a v
Cons (PValue v0 -> PValue v1 -> PValue v2
f PValue v0
x PValue v1
y))
liftGen :: (PValue v -> x) -> (T a v -> x)
liftGen :: (PValue v -> x) -> T a v -> x
liftGen PValue v -> x
f (Cons PValue v
x) = PValue v -> x
f PValue v
x
lift2Gen :: (PValue v0 -> PValue v1 -> x) ->
(T a v0 -> T a v1 -> x)
lift2Gen :: (PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v0 -> PValue v1 -> x
f (Cons PValue v0
x) (Cons PValue v1
y) = PValue v0 -> PValue v1 -> x
f PValue v0
x PValue v1
y
scale :: Ring.C v => v -> T a v -> T a v
scale :: v -> T a v -> T a v
scale = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift ((PValue v -> PValue v) -> T a v -> T a v)
-> (v -> PValue v -> PValue v) -> v -> T a v -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> PValue v -> PValue v
forall i a. (Ord i, C a) => a -> T i a -> T i a
Value.scale
fromScalarSingle :: v -> T a v
fromScalarSingle :: v -> T a v
fromScalarSingle = PValue v -> T a v
forall a v. PValue v -> T a v
Cons (PValue v -> T a v) -> (v -> PValue v) -> v -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> PValue v
forall a i. a -> T i a
Value.fromScalarSingle
instance (ZeroTestable.C v) => ZeroTestable.C (T a v) where
isZero :: T a v -> Bool
isZero = (PValue v -> Bool) -> T a v -> Bool
forall v x a. (PValue v -> x) -> T a v -> x
liftGen PValue v -> Bool
forall a. C a => a -> Bool
isZero
instance Eq v => Eq (T a v) where
== :: T a v -> T a v -> Bool
(==) = (PValue v -> PValue v -> Bool) -> T a v -> T a v -> Bool
forall v0 v1 x a.
(PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v -> PValue v -> Bool
forall a. Eq a => a -> a -> Bool
(==)
showNat :: (Show v, Field.C a, Ord a, NormedMax.C a v) =>
UnitDatabase.T Dimension a -> T a v -> String
showNat :: T Dimension a -> T a v -> String
showNat T Dimension a
db =
(PValue v -> String) -> T a v -> String
forall v x a. (PValue v -> x) -> T a v -> x
liftGen (T Dimension a -> PValue v -> String
forall i v a.
(Ord i, Show v, C a, Ord a, C a v) =>
T i a -> T i v -> String
PVShow.showNat T Dimension a
db)
instance (Show v, Ord a, Trans.C a, NormedMax.C a v) =>
Show (T a v) where
showsPrec :: Int -> T a v -> ShowS
showsPrec Int
prec T a v
x =
Bool -> ShowS -> ShowS
showParen (Int
prec Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
PVShow.mulPrec)
(T Dimension a -> T a v -> String
forall v a.
(Show v, C a, Ord a, C a v) =>
T Dimension a -> T a v -> String
showNat T Dimension a
forall a. C a => T Dimension a
SIUnit.databaseShow T a v
x String -> ShowS
forall a. [a] -> [a] -> [a]
++)
readsNat :: (Read v, VectorSpace.C a v) =>
UnitDatabase.T Dimension a -> Int -> ReadS (T a v)
readsNat :: T Dimension a -> Int -> ReadS (T a v)
readsNat T Dimension a
db Int
prec =
((PValue v, String) -> (T a v, String))
-> [(PValue v, String)] -> [(T a v, String)]
forall a b. (a -> b) -> [a] -> [b]
map ((PValue v -> T a v) -> (PValue v, String) -> (T a v, String)
forall a c b. (a -> c) -> (a, b) -> (c, b)
mapFst PValue v -> T a v
forall a v. PValue v -> T a v
Cons) ([(PValue v, String)] -> [(T a v, String)])
-> (String -> [(PValue v, String)]) -> ReadS (T a v)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. T Dimension a -> Int -> String -> [(PValue v, String)]
forall i v a.
(Enum i, Ord i, Read v, C a v) =>
T i a -> Int -> ReadS (T i v)
PVRead.readsNat T Dimension a
db Int
prec
instance (Read v, Ord a, Trans.C a, VectorSpace.C a v) =>
Read (T a v) where
readsPrec :: Int -> ReadS (T a v)
readsPrec = T Dimension a -> Int -> ReadS (T a v)
forall v a.
(Read v, C a v) =>
T Dimension a -> Int -> ReadS (T a v)
readsNat T Dimension a
forall a. C a => T Dimension a
SIUnit.databaseRead
instance (Additive.C v) => Additive.C (T a v) where
zero :: T a v
zero = PValue v -> T a v
forall a v. PValue v -> T a v
Cons PValue v
forall a. C a => a
zero
+ :: T a v -> T a v -> T a v
(+) = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. C a => a -> a -> a
(+)
(-) = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 (-)
negate :: T a v -> T a v
negate = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
negate
instance (Ring.C v) => Ring.C (T a v) where
* :: T a v -> T a v -> T a v
(*) = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. C a => a -> a -> a
(*)
fromInteger :: Integer -> T a v
fromInteger = PValue v -> T a v
forall a v. PValue v -> T a v
Cons (PValue v -> T a v) -> (Integer -> PValue v) -> Integer -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> PValue v
forall a. C a => Integer -> a
fromInteger
instance (Ord v) => Ord (T a v) where
max :: T a v -> T a v -> T a v
max = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. Ord a => a -> a -> a
max
min :: T a v -> T a v -> T a v
min = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. Ord a => a -> a -> a
min
compare :: T a v -> T a v -> Ordering
compare = (PValue v -> PValue v -> Ordering) -> T a v -> T a v -> Ordering
forall v0 v1 x a.
(PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v -> PValue v -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
< :: T a v -> T a v -> Bool
(<) = (PValue v -> PValue v -> Bool) -> T a v -> T a v -> Bool
forall v0 v1 x a.
(PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v -> PValue v -> Bool
forall a. Ord a => a -> a -> Bool
(<)
> :: T a v -> T a v -> Bool
(>) = (PValue v -> PValue v -> Bool) -> T a v -> T a v -> Bool
forall v0 v1 x a.
(PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v -> PValue v -> Bool
forall a. Ord a => a -> a -> Bool
(>)
<= :: T a v -> T a v -> Bool
(<=) = (PValue v -> PValue v -> Bool) -> T a v -> T a v -> Bool
forall v0 v1 x a.
(PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v -> PValue v -> Bool
forall a. Ord a => a -> a -> Bool
(<=)
>= :: T a v -> T a v -> Bool
(>=) = (PValue v -> PValue v -> Bool) -> T a v -> T a v -> Bool
forall v0 v1 x a.
(PValue v0 -> PValue v1 -> x) -> T a v0 -> T a v1 -> x
lift2Gen PValue v -> PValue v -> Bool
forall a. Ord a => a -> a -> Bool
(>=)
instance (Absolute.C v) => Absolute.C (T a v) where
abs :: T a v -> T a v
abs = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
abs
signum :: T a v -> T a v
signum = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
signum
instance (Field.C v) => Field.C (T a v) where
/ :: T a v -> T a v -> T a v
(/) = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. C a => a -> a -> a
(/)
fromRational' :: Rational -> T a v
fromRational' = PValue v -> T a v
forall a v. PValue v -> T a v
Cons (PValue v -> T a v) -> (Rational -> PValue v) -> Rational -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> PValue v
forall a. C a => Rational -> a
fromRational'
instance (Algebraic.C v) => Algebraic.C (T a v) where
sqrt :: T a v -> T a v
sqrt = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
sqrt
T a v
x ^/ :: T a v -> Rational -> T a v
^/ Rational
y = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift (PValue v -> Rational -> PValue v
forall a. C a => a -> Rational -> a
^/ Rational
y) T a v
x
instance (Trans.C v) => Trans.C (T a v) where
pi :: T a v
pi = PValue v -> T a v
forall a v. PValue v -> T a v
Cons PValue v
forall a. C a => a
pi
log :: T a v -> T a v
log = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
log
exp :: T a v -> T a v
exp = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
exp
logBase :: T a v -> T a v -> T a v
logBase = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. C a => a -> a -> a
logBase
** :: T a v -> T a v -> T a v
(**) = (PValue v -> PValue v -> PValue v) -> T a v -> T a v -> T a v
forall v0 v1 v2 a.
(PValue v0 -> PValue v1 -> PValue v2) -> T a v0 -> T a v1 -> T a v2
lift2 PValue v -> PValue v -> PValue v
forall a. C a => a -> a -> a
(**)
cos :: T a v -> T a v
cos = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
cos
tan :: T a v -> T a v
tan = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
tan
sin :: T a v -> T a v
sin = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
sin
acos :: T a v -> T a v
acos = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
acos
atan :: T a v -> T a v
atan = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
atan
asin :: T a v -> T a v
asin = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
asin
cosh :: T a v -> T a v
cosh = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
cosh
tanh :: T a v -> T a v
tanh = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
tanh
sinh :: T a v -> T a v
sinh = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
sinh
acosh :: T a v -> T a v
acosh = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
acosh
atanh :: T a v -> T a v
atanh = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
atanh
asinh :: T a v -> T a v
asinh = (PValue v -> PValue v) -> T a v -> T a v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift PValue v -> PValue v
forall a. C a => a -> a
asinh
instance Vector.C (T a) where
zero :: T a a
zero = T a a
forall a. C a => a
zero
<+> :: T a a -> T a a -> T a a
(<+>) = T a a -> T a a -> T a a
forall a. C a => a -> a -> a
(+)
*> :: a -> T a a -> T a a
(*>) = a -> T a a -> T a a
forall v a. C v => v -> T a v -> T a v
scale
instance (Module.C a v) => Module.C a (T b v) where
*> :: a -> T b v -> T b v
(*>) a
x = (PValue v -> PValue v) -> T b v -> T b v
forall v0 v1 a. (PValue v0 -> PValue v1) -> T a v0 -> T a v1
lift (a
x a -> PValue v -> PValue v
forall a v. C a v => a -> v -> v
Module.*>)
instance (VectorSpace.C a v) => VectorSpace.C a (T b v)
instance (Trans.C a, Ord a, OccScalar.C a v,
Show v, NormedMax.C a v)
=> OccScalar.C a (T a v) where
toScalar :: T a v -> a
toScalar = T a v -> a
forall a v. (C a v, Show v) => v -> a
toScalarShow
toMaybeScalar :: T a v -> Maybe a
toMaybeScalar = (PValue v -> Maybe a) -> T a v -> Maybe a
forall v x a. (PValue v -> x) -> T a v -> x
liftGen PValue v -> Maybe a
forall a v. C a v => v -> Maybe a
toMaybeScalar
fromScalar :: a -> T a v
fromScalar = PValue v -> T a v
forall a v. PValue v -> T a v
Cons (PValue v -> T a v) -> (a -> PValue v) -> a -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> PValue v
forall a v. C a v => a -> v
fromScalar
quantity :: (Field.C a, Field.C v) => Unit.T Dimension -> v -> T a v
quantity :: T Dimension -> v -> T a v
quantity T Dimension
xu = PValue v -> T a v
forall a v. PValue v -> T a v
Cons (PValue v -> T a v) -> (v -> PValue v) -> v -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. T Dimension -> v -> PValue v
forall i a. T i -> a -> T i a
Value.Cons T Dimension
xu
hertz, second, minute, hour, day, year,
meter, liter, gramm, tonne,
newton, pascal, bar, joule, watt,
kelvin,
coulomb, ampere, volt, ohm, farad,
bit, byte, baud,
inch, foot, yard, astronomicUnit, parsec,
mach, speedOfLight, electronVolt,
calorien, horsePower, accelerationOfEarthGravity ::
(Field.C a, Field.C v) => T a v
hertz :: T a v
hertz = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.frequency v
1e+0
second :: T a v
second = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.time v
1e+0
minute :: T a v
minute = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.time v
forall a. C a => a
SIUnit.secondsPerMinute
hour :: T a v
hour = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.time v
forall a. C a => a
SIUnit.secondsPerHour
day :: T a v
day = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.time v
forall a. C a => a
SIUnit.secondsPerDay
year :: T a v
year = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.time v
forall a. C a => a
SIUnit.secondsPerYear
meter :: T a v
meter = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.length v
1e+0
liter :: T a v
liter = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.volume v
1e-3
gramm :: T a v
gramm = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.mass v
1e-3
tonne :: T a v
tonne = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.mass v
1e+3
newton :: T a v
newton = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.force v
1e+0
pascal :: T a v
pascal = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.pressure v
1e+0
bar :: T a v
bar = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.pressure v
1e+5
joule :: T a v
joule = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.energy v
1e+0
watt :: T a v
watt = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.power v
1e+0
coulomb :: T a v
coulomb = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.charge v
1e+0
ampere :: T a v
ampere = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.current v
1e+0
volt :: T a v
volt = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.voltage v
1e+0
ohm :: T a v
ohm = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.resistance v
1e+0
farad :: T a v
farad = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.capacitance v
1e+0
kelvin :: T a v
kelvin = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.temperature v
1e+0
bit :: T a v
bit = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.information v
1e+0
byte :: T a v
byte = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.information v
forall a. C a => a
bytesize
baud :: T a v
baud = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.dataRate v
1e+0
inch :: T a v
inch = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.length v
forall a. C a => a
SIUnit.meterPerInch
= T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.length v
forall a. C a => a
SIUnit.meterPerFoot
yard :: T a v
yard = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.length v
forall a. C a => a
SIUnit.meterPerYard
astronomicUnit :: T a v
astronomicUnit = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.length v
forall a. C a => a
SIUnit.meterPerAstronomicUnit
parsec :: T a v
parsec = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.length v
forall a. C a => a
SIUnit.meterPerParsec
accelerationOfEarthGravity :: T a v
accelerationOfEarthGravity
= T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.acceleration v
forall a. C a => a
SIUnit.accelerationOfEarthGravity
mach :: T a v
mach = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.speed v
forall a. C a => a
SIUnit.mach
speedOfLight :: T a v
speedOfLight = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.speed v
forall a. C a => a
SIUnit.speedOfLight
electronVolt :: T a v
electronVolt = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.energy v
forall a. C a => a
SIUnit.electronVolt
calorien :: T a v
calorien = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.energy v
forall a. C a => a
SIUnit.calorien
horsePower :: T a v
horsePower = T Dimension -> v -> T a v
forall a v. (C a, C v) => T Dimension -> v -> T a v
quantity T Dimension
SIUnit.power v
forall a. C a => a
SIUnit.horsePower
instance (P.Num v) => P.Num (T a v) where
fromInteger :: Integer -> T a v
fromInteger = v -> T a v
forall v a. v -> T a v
fromScalarSingle (v -> T a v) -> (Integer -> v) -> Integer -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> v
forall a. Num a => Integer -> a
P.fromInteger
negate :: T a v -> T a v
negate = (T a (T v) -> T a (T v)) -> T a v -> T a v
forall (f :: * -> *) a b.
Functor f =>
(f (T a) -> f (T b)) -> f a -> f b
W98.unliftF1 T a (T v) -> T a (T v)
forall a. C a => a -> a
Additive.negate
+ :: T a v -> T a v -> T a v
(+) = (T a (T v) -> T a (T v) -> T a (T v)) -> T a v -> T a v -> T a v
forall (f :: * -> *) a b c.
Functor f =>
(f (T a) -> f (T b) -> f (T c)) -> f a -> f b -> f c
W98.unliftF2 T a (T v) -> T a (T v) -> T a (T v)
forall a. C a => a -> a -> a
(Additive.+)
* :: T a v -> T a v -> T a v
(*) = (T a (T v) -> T a (T v) -> T a (T v)) -> T a v -> T a v -> T a v
forall (f :: * -> *) a b c.
Functor f =>
(f (T a) -> f (T b) -> f (T c)) -> f a -> f b -> f c
W98.unliftF2 T a (T v) -> T a (T v) -> T a (T v)
forall a. C a => a -> a -> a
(Ring.*)
abs :: T a v -> T a v
abs = (T a (T v) -> T a (T v)) -> T a v -> T a v
forall (f :: * -> *) a b.
Functor f =>
(f (T a) -> f (T b)) -> f a -> f b
W98.unliftF1 T a (T v) -> T a (T v)
forall a. C a => a -> a
Absolute.abs
signum :: T a v -> T a v
signum = (T a (T v) -> T a (T v)) -> T a v -> T a v
forall (f :: * -> *) a b.
Functor f =>
(f (T a) -> f (T b)) -> f a -> f b
W98.unliftF1 T a (T v) -> T a (T v)
forall a. C a => a -> a
Absolute.signum
instance (P.Fractional v) => P.Fractional (T a v) where
fromRational :: Rational -> T a v
fromRational = v -> T a v
forall v a. v -> T a v
fromScalarSingle (v -> T a v) -> (Rational -> v) -> Rational -> T a v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> v
forall a. Fractional a => Rational -> a
P.fromRational
/ :: T a v -> T a v -> T a v
(/) = (T a (T v) -> T a (T v) -> T a (T v)) -> T a v -> T a v -> T a v
forall (f :: * -> *) a b c.
Functor f =>
(f (T a) -> f (T b) -> f (T c)) -> f a -> f b -> f c
W98.unliftF2 T a (T v) -> T a (T v) -> T a (T v)
forall a. C a => a -> a -> a
(Field./)