dimensional-1.6.1: Statically checked physical dimensions

Copyright | Copyright (C) 2006-2018 Bjorn Buckwalter
License | BSD3
Maintainer | bjorn@buckwalter.se
Stability | Experimental
Portability | GHC only?
Safe Haskell | None
Language | Haskell2010

Numeric.Units.Dimensional.FixedPoint

Contents

- Types
- Physical Dimensions
  - Dimension Arithmetic
  - Term Level Representation of Dimensions
- Dimensional Arithmetic
  - Transcendental Functions
    - Via `Double`
    - Via arbitary `Floating` type
  - Operations on Collections
  - Conversion Between Representations
- Dimension Synonyms
- Quantity Synonyms
- Constants
- Constructing Units
- Unit Metadata
- Commonly Used Type Synonyms

Description

Defines types for manipulation of quantities with fixed point representations.

Synopsis

- data family Dimensional (v :: Variant) :: Dimension -> Type -> Type
- type Unit (m :: Metricality) = Dimensional ('DUnit m)
- type Quantity = SQuantity One
- type SQuantity (s :: ExactPi') = Dimensional ('DQuantity s)
- data Metricality
  - = Metric
  - | NonMetric
- data Dimension = Dim TypeInt TypeInt TypeInt TypeInt TypeInt TypeInt TypeInt
- type family (a :: Dimension) * (b :: Dimension) :: Dimension where ...
- type family (a :: Dimension) / (d :: Dimension) :: Dimension where ...
- type family (d :: Dimension) ^ (x :: TypeInt) :: Dimension where ...
- type family NRoot (d :: Dimension) (x :: TypeInt) :: Dimension where ...
- type Recip (d :: Dimension) = DOne / d
- data Dimension' = Dim' !Int !Int !Int !Int !Int !Int !Int
- class HasDynamicDimension a => HasDimension a where
  - dimension :: a -> Dimension'
- type KnownDimension (d :: Dimension) = HasDimension (Proxy d)
- (*~) :: forall (s :: ExactPi') (m :: Metricality) (d :: Dimension) a b. (RealFrac a, Integral b, MinCtxt s a) => a -> Unit m d a -> SQuantity s d b
- (/~) :: forall (s :: ExactPi') (m :: Metricality) (d :: Dimension) a b. (Real a, Fractional b, MinCtxt s b) => SQuantity s d a -> Unit m d b -> b
- (*) :: forall (v1 :: Variant) (v2 :: Variant) a (d1 :: Dimension) (d2 :: Dimension). (KnownVariant v1, KnownVariant v2, KnownVariant (v1 * v2), Num a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 * v2) (d1 * d2) a
- (/) :: forall (v1 :: Variant) (v2 :: Variant) a (d1 :: Dimension) (d2 :: Dimension). (KnownVariant v1, KnownVariant v2, KnownVariant (v1 / v2), Fractional a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 / v2) (d1 / d2) a
- (+) :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a -> SQuantity s d a
- (-) :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a -> SQuantity s d a
- negate :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a
- abs :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a
- expD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- logD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- sinD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- cosD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- tanD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- asinD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- acosD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- atanD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- sinhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- coshD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- tanhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- asinhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- acoshD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- atanhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
- atan2D :: forall a b (s1 :: ExactPi') (s2 :: ExactPi') (s3 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double, MinCtxt s3 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne a -> SQuantity s3 DOne b
- expVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- logVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- sinVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- cosVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- tanVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- asinVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- acosVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- atanVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- sinhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- coshVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- tanhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- asinhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- acoshVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- atanhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
- atan2Via :: forall (s1 :: ExactPi') (s2 :: ExactPi') (s3 :: ExactPi') a b c (d :: Dimension). (Integral a, RealFloat b, Integral c, MinCtxt s1 b, MinCtxt s2 b, MinCtxt s3 b, KnownDimension d) => Proxy b -> SQuantity s1 d a -> SQuantity s2 d a -> SQuantity s3 DOne c
- (*~~) :: forall f a b (s :: ExactPi') (m :: Metricality) (d :: Dimension). (Functor f, RealFrac a, Integral b, MinCtxt s a) => f a -> Unit m d a -> f (SQuantity s d b)
- (/~~) :: forall f a b (s :: ExactPi') (d :: Dimension) (m :: Metricality). (Functor f, Real a, Fractional b, MinCtxt s b) => f (SQuantity s d a) -> Unit m d b -> f b
- sum :: forall a f (s :: ExactPi') (d :: Dimension). (Num a, Foldable f) => f (SQuantity s d a) -> SQuantity s d a
- mean :: forall a f (s :: ExactPi') (d :: Dimension). (Fractional a, Foldable f) => f (SQuantity s d a) -> SQuantity s d a
- rescale :: forall a b (d :: Dimension) (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b
- rescaleFinite :: forall a b (s1 :: ExactPi') (s2 :: ExactPi') (d :: Dimension). (Integral a, FiniteBits a, Integral b, FiniteBits b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b
- rescaleD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi') (d :: Dimension). (Integral a, Integral b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b
- rescaleVia :: forall a b c (d :: Dimension) (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, KnownExactPi s1, KnownExactPi s2) => Proxy b -> SQuantity s1 d a -> SQuantity s2 d c
- class KnownVariant (v :: Variant) where
  - dmap :: forall a1 a2 (d :: Dimension). (a1 -> a2) -> Dimensional v d a1 -> Dimensional v d a2
- changeRep :: forall (v1 :: Variant) (v2 :: Variant) (d :: Dimension) a b. (KnownVariant v1, KnownVariant v2, CompatibleVariants v1 v2, MinCtxt (ScaleFactor v1 / ScaleFactor v2) b, Real a, Fractional b) => Dimensional v1 d a -> Dimensional v2 d b
- changeRepRound :: forall (v1 :: Variant) (v2 :: Variant) (d :: Dimension) a b. (KnownVariant v1, KnownVariant v2, CompatibleVariants v1 v2, MinCtxt (ScaleFactor v1 / ScaleFactor v2) a, RealFrac a, Integral b) => Dimensional v1 d a -> Dimensional v2 d b
- changeRepApproximate :: forall (v :: Variant) b (d :: Dimension). (KnownVariant v, Floating b) => Dimensional v d ExactPi -> Dimensional v d b
- type DOne = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
- type DLength = 'Dim 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
- type DMass = 'Dim 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
- type DTime = 'Dim 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero
- type DElectricCurrent = 'Dim 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
- type DThermodynamicTemperature = 'Dim 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero
- type DAmountOfSubstance = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero
- type DLuminousIntensity = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1
- type Dimensionless = Quantity DOne
- type Length = Quantity DLength
- type Mass = Quantity DMass
- type Time = Quantity DTime
- type ElectricCurrent = Quantity DElectricCurrent
- type ThermodynamicTemperature = Quantity DThermodynamicTemperature
- type AmountOfSubstance = Quantity DAmountOfSubstance
- type LuminousIntensity = Quantity DLuminousIntensity
- _0 :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a
- epsilon :: forall a (s :: ExactPi') (d :: Dimension). Integral a => SQuantity s d a
- _1 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _2 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _3 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _4 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _5 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _6 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _7 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _8 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- _9 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- pi :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- tau :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a
- siUnit :: forall (d :: Dimension) a. (KnownDimension d, Num a) => Unit 'NonMetric d a
- one :: Num a => Unit 'NonMetric DOne a
- mkUnitR :: forall a (m :: Metricality) (m1 :: Metricality) (d :: Dimension). Floating a => UnitName m -> ExactPi -> Unit m1 d a -> Unit m d a
- mkUnitQ :: forall a (m :: Metricality) (m1 :: Metricality) (d :: Dimension). Fractional a => UnitName m -> Rational -> Unit m1 d a -> Unit m d a
- mkUnitZ :: forall a (m :: Metricality) (m1 :: Metricality) (d :: Dimension). Num a => UnitName m -> Integer -> Unit m1 d a -> Unit m d a
- name :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> UnitName m
- exactValue :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> ExactPi
- weaken :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> Unit 'NonMetric d a
- strengthen :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> Maybe (Unit 'Metric d a)
- exactify :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> Unit m d ExactPi
- type Q (n :: Natural) a = SQuantity (QScale n) DOne a
- type QScale (n :: Natural) = One / ExactNatural (2 ^ n)
- type Angle8 = SQuantity (Pi * QScale 7) DPlaneAngle Int8
- type Angle16 = SQuantity (Pi * QScale 15) DPlaneAngle Int16
- type Angle32 = SQuantity (Pi * QScale 31) DPlaneAngle Int32

# Types

We provide access to the same `Dimensional`, `Unit`, and `Quantity` types as are exposed by Numeric.Units.Dimensional, but additionally offer the `SQuantity` type to represent scaled quantities. Fixed-point quantities are quantities backed by integers, it is frequently necessary to scale those integers into a range appropriate for the physical problem at hand.

data family Dimensional (v :: Variant) :: Dimension -> Type -> Type Source #

A dimensional value, either a `Quantity` or a `Unit`, parameterized by its `Dimension` and representation.

#### Instances

Instances details

Generic1 (Dimensional ('DQuantity s) d :: Type -> Type) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Associated Types

type Rep1 (Dimensional ('DQuantity s) d :: Type -> Type) |
Instance details Defined in Numeric.Units.Dimensional.Internal type Rep1 (Dimensional ('DQuantity s) d :: Type -> Type) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'True) (C1 ('MetaCons "Quantity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

Methods

from1 :: Dimensional ('DQuantity s) d a -> Rep1 (Dimensional ('DQuantity s) d) a Source #

to1 :: Rep1 (Dimensional ('DQuantity s) d) a -> Dimensional ('DQuantity s) d a Source #

Generic1 (Dimensional ('DUnit m) d :: Type -> Type) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Associated Types

type Rep1 (Dimensional ('DUnit m) d :: Type -> Type) |

Instance details

Defined in Numeric.Units.Dimensional.Internal

type Rep1 (Dimensional ('DUnit m) d :: Type -> Type) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Unit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (UnitName m)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ExactPi) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1)))

Methods

from1 :: Dimensional ('DUnit m) d a -> Rep1 (Dimensional ('DUnit m) d) a Source #

to1 :: Rep1 (Dimensional ('DUnit m) d) a -> Dimensional ('DUnit m) d a Source #

Vector Vector a => Vector Vector (SQuantity s d a) |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Methods

basicUnsafeFreeze :: Mutable Vector s0 (SQuantity s d a) -> ST s0 (Vector (SQuantity s d a))

basicUnsafeThaw :: Vector (SQuantity s d a) -> ST s0 (Mutable Vector s0 (SQuantity s d a))

basicLength :: Vector (SQuantity s d a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (SQuantity s d a) -> Vector (SQuantity s d a)

basicUnsafeIndexM :: Vector (SQuantity s d a) -> Int -> Box (SQuantity s d a)

basicUnsafeCopy :: Mutable Vector s0 (SQuantity s d a) -> Vector (SQuantity s d a) -> ST s0 ()

elemseq :: Vector (SQuantity s d a) -> SQuantity s d a -> b -> b

MVector MVector a => MVector MVector (SQuantity s d a) |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Methods

basicLength :: MVector s0 (SQuantity s d a) -> Int

basicUnsafeSlice :: Int -> Int -> MVector s0 (SQuantity s d a) -> MVector s0 (SQuantity s d a)

basicOverlaps :: MVector s0 (SQuantity s d a) -> MVector s0 (SQuantity s d a) -> Bool

basicUnsafeNew :: Int -> ST s0 (MVector s0 (SQuantity s d a))

basicInitialize :: MVector s0 (SQuantity s d a) -> ST s0 ()

basicUnsafeReplicate :: Int -> SQuantity s d a -> ST s0 (MVector s0 (SQuantity s d a))

basicUnsafeRead :: MVector s0 (SQuantity s d a) -> Int -> ST s0 (SQuantity s d a)

basicUnsafeWrite :: MVector s0 (SQuantity s d a) -> Int -> SQuantity s d a -> ST s0 ()

basicClear :: MVector s0 (SQuantity s d a) -> ST s0 ()

basicSet :: MVector s0 (SQuantity s d a) -> SQuantity s d a -> ST s0 ()

basicUnsafeCopy :: MVector s0 (SQuantity s d a) -> MVector s0 (SQuantity s d a) -> ST s0 ()

basicUnsafeMove :: MVector s0 (SQuantity s d a) -> MVector s0 (SQuantity s d a) -> ST s0 ()

basicUnsafeGrow :: MVector s0 (SQuantity s d a) -> Int -> ST s0 (MVector s0 (SQuantity s d a))

KnownDimension d => Demotable (Quantity d) Source # |
Instance details Defined in Numeric.Units.Dimensional.Dynamic Methods demotableOut :: Quantity d a -> AnyQuantity a
Eq1 (SQuantity s d) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods liftEq :: (a -> b -> Bool) -> SQuantity s d a -> SQuantity s d b -> Bool Source #
Ord1 (SQuantity s d) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods liftCompare :: (a -> b -> Ordering) -> SQuantity s d a -> SQuantity s d b -> Ordering Source #
NFData a => NFData (Quantity d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods rnf :: Quantity d a -> () Source #
KnownVariant v => Functor (Dimensional v d) Source # | A `Functor` instance for `Dimensional`. Note that this instance is dubious, because it allows you to break the dimensional abstraction. See `dmap` for more information. Note that, while this instance overlaps with that given for `Dimensionless`, it is confluent with that instance. Note that this is an orphan instance.
Instance details Defined in Numeric.Units.Dimensional.Functor Methods fmap :: (a -> b) -> Dimensional v d a -> Dimensional v d b Source # (<$) :: a -> Dimensional v d b -> Dimensional v d a Source #
Functor (SQuantity s DOne) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods fmap :: (a -> b) -> SQuantity s DOne a -> SQuantity s DOne b Source # (<$) :: a -> SQuantity s DOne b -> SQuantity s DOne a Source #
KnownDimension d => HasDimension (Dimensional v d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods dimension :: Dimensional v d a -> Dimension' Source #
KnownDimension d => HasDynamicDimension (Dimensional v d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods dynamicDimension :: Dimensional v d a -> DynamicDimension Source #
HasInterchangeName (Unit m d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods interchangeName :: Unit m d a -> InterchangeName Source #
Num a => Monoid (SQuantity s d a) Source # | `Quantity`s of a given `Dimension` form a `Monoid` under addition.
Instance details Defined in Numeric.Units.Dimensional.Internal Methods mempty :: SQuantity s d a Source # mappend :: SQuantity s d a -> SQuantity s d a -> SQuantity s d a Source # mconcat :: [SQuantity s d a] -> SQuantity s d a Source #
Num a => Semigroup (SQuantity s d a) Source # | `Quantity`s of a given `Dimension` form a `Semigroup` under addition.
Instance details Defined in Numeric.Units.Dimensional.Internal Methods (<>) :: SQuantity s d a -> SQuantity s d a -> SQuantity s d a Source # sconcat :: NonEmpty (SQuantity s d a) -> SQuantity s d a Source # stimes :: Integral b => b -> SQuantity s d a -> SQuantity s d a Source #
(Typeable s, Typeable d, Data a) => Data (Dimensional ('DQuantity s) d a) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Methods

gfoldl :: (forall d0 b. Data d0 => c (d0 -> b) -> d0 -> c b) -> (forall g. g -> c g) -> Dimensional ('DQuantity s) d a -> c (Dimensional ('DQuantity s) d a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Dimensional ('DQuantity s) d a) Source #

toConstr :: Dimensional ('DQuantity s) d a -> Constr Source #

dataTypeOf :: Dimensional ('DQuantity s) d a -> DataType Source #

dataCast1 :: Typeable t => (forall d0. Data d0 => c (t d0)) -> Maybe (c (Dimensional ('DQuantity s) d a)) Source #

dataCast2 :: Typeable t => (forall d0 e. (Data d0, Data e) => c (t d0 e)) -> Maybe (c (Dimensional ('DQuantity s) d a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d0. Data d0 => d0 -> r') -> Dimensional ('DQuantity s) d a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d0. Data d0 => d0 -> r') -> Dimensional ('DQuantity s) d a -> r Source #

gmapQ :: (forall d0. Data d0 => d0 -> u) -> Dimensional ('DQuantity s) d a -> [u] Source #

gmapQi :: Int -> (forall d0. Data d0 => d0 -> u) -> Dimensional ('DQuantity s) d a -> u Source #

gmapM :: Monad m => (forall d0. Data d0 => d0 -> m d0) -> Dimensional ('DQuantity s) d a -> m (Dimensional ('DQuantity s) d a) Source #

gmapMp :: MonadPlus m => (forall d0. Data d0 => d0 -> m d0) -> Dimensional ('DQuantity s) d a -> m (Dimensional ('DQuantity s) d a) Source #

gmapMo :: MonadPlus m => (forall d0. Data d0 => d0 -> m d0) -> Dimensional ('DQuantity s) d a -> m (Dimensional ('DQuantity s) d a) Source #

Bounded a => Bounded (SQuantity s d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods minBound :: SQuantity s d a Source # maxBound :: SQuantity s d a Source #
Storable a => Storable (SQuantity s d a) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Methods

sizeOf :: SQuantity s d a -> Int Source #

alignment :: SQuantity s d a -> Int Source #

peekElemOff :: Ptr (SQuantity s d a) -> Int -> IO (SQuantity s d a) Source #

pokeElemOff :: Ptr (SQuantity s d a) -> Int -> SQuantity s d a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (SQuantity s d a) Source #

pokeByteOff :: Ptr b -> Int -> SQuantity s d a -> IO () Source #

peek :: Ptr (SQuantity s d a) -> IO (SQuantity s d a) Source #

poke :: Ptr (SQuantity s d a) -> SQuantity s d a -> IO () Source #

Generic (Dimensional ('DQuantity s) d a) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Associated Types

type Rep (Dimensional ('DQuantity s) d a) |
Instance details Defined in Numeric.Units.Dimensional.Internal type Rep (Dimensional ('DQuantity s) d a) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'True) (C1 ('MetaCons "Quantity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: Dimensional ('DQuantity s) d a -> Rep (Dimensional ('DQuantity s) d a) x Source #

to :: Rep (Dimensional ('DQuantity s) d a) x -> Dimensional ('DQuantity s) d a Source #

Generic (Dimensional ('DUnit m) d a) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Associated Types

type Rep (Dimensional ('DUnit m) d a) |

Instance details

Defined in Numeric.Units.Dimensional.Internal

type Rep (Dimensional ('DUnit m) d a) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Unit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (UnitName m)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ExactPi) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))))

Methods

from :: Dimensional ('DUnit m) d a -> Rep (Dimensional ('DUnit m) d a) x Source #

to :: Rep (Dimensional ('DUnit m) d a) x -> Dimensional ('DUnit m) d a Source #

(KnownDimension d, KnownExactPi s, Show a, Real a) => Show (SQuantity s d a) Source # | Uses non-breaking spaces between the value and the unit, and within the unit name.
Instance details Defined in Numeric.Units.Dimensional.Internal Methods showsPrec :: Int -> SQuantity s d a -> ShowS Source # show :: SQuantity s d a -> String Source # showList :: [SQuantity s d a] -> ShowS Source #
Show a => Show (Unit m d a) Source # | Unit names are shown with non-breaking spaces.
Instance details Defined in Numeric.Units.Dimensional.Internal Methods showsPrec :: Int -> Unit m d a -> ShowS Source # show :: Unit m d a -> String Source # showList :: [Unit m d a] -> ShowS Source #
Eq a => Eq (Dimensional ('DQuantity s) d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods (==) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source # (/=) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source #
Ord a => Ord (Dimensional ('DQuantity s) d a) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Methods

compare :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Ordering Source #

(<) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source #

(<=) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source #

(>) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source #

(>=) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source #

max :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a Source #

min :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a Source #

AEq a => AEq (Dimensional ('DQuantity s) d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods (===) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source # (~==) :: Dimensional ('DQuantity s) d a -> Dimensional ('DQuantity s) d a -> Bool Source #
Unbox a => Unbox (SQuantity s d a) |
Instance details Defined in Numeric.Units.Dimensional.Internal
type Rep1 (Dimensional ('DQuantity s) d :: Type -> Type) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal type Rep1 (Dimensional ('DQuantity s) d :: Type -> Type) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'True) (C1 ('MetaCons "Quantity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Rep1 (Dimensional ('DUnit m) d :: Type -> Type) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

type Rep1 (Dimensional ('DUnit m) d :: Type -> Type) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Unit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (UnitName m)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ExactPi) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1)))

newtype MVector v (SQuantity s d a) |

Instance details

Defined in Numeric.Units.Dimensional.Internal

newtype MVector v (SQuantity s d a) = MV_Quantity {

- unMVQ :: MVector v a

}

newtype Dimensional ('DQuantity s) d a Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal newtype Dimensional ('DQuantity s) d a = Quantity a
data Dimensional ('DUnit m) d a Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal data Dimensional ('DUnit m) d a = Unit !(UnitName m) !ExactPi !a
type Rep (Dimensional ('DQuantity s) d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal type Rep (Dimensional ('DQuantity s) d a) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'True) (C1 ('MetaCons "Quantity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (Dimensional ('DUnit m) d a) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

type Rep (Dimensional ('DUnit m) d a) = D1 ('MetaData "Dimensional" "Numeric.Units.Dimensional.Internal" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Unit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (UnitName m)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ExactPi) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))))

newtype Vector (SQuantity s d a) |

Instance details

Defined in Numeric.Units.Dimensional.Internal

newtype Vector (SQuantity s d a) = V_Quantity {

- unVQ :: Vector a

}

type Unit (m :: Metricality) = Dimensional ('DUnit m) Source #

A unit of measurement.

type Quantity = SQuantity One Source #

A dimensional quantity.

type SQuantity (s :: ExactPi') = Dimensional ('DQuantity s) Source #

A dimensional quantity, stored as an `ExactPi'` multiple of its value in its dimension's SI coherent unit.

The name is an abbreviation for scaled quantity.

data Metricality Source #

Encodes whether a unit is a metric unit, that is, whether it can be combined with a metric prefix to form a related unit.

Constructors

Metric | Capable of receiving a metric prefix.
NonMetric | Incapable of receiving a metric prefix.

#### Instances

Instances details

NFData Metricality Source # |
Instance details Defined in Numeric.Units.Dimensional.Variants Methods rnf :: Metricality -> () Source #
Data Metricality Source # |

Instance details

Defined in Numeric.Units.Dimensional.Variants

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Metricality -> c Metricality Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Metricality Source #

toConstr :: Metricality -> Constr Source #

dataTypeOf :: Metricality -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Metricality) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Metricality) Source #

gmapT :: (forall b. Data b => b -> b) -> Metricality -> Metricality Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Metricality -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Metricality -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Metricality -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Metricality -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Metricality -> m Metricality Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Metricality -> m Metricality Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Metricality -> m Metricality Source #

Generic Metricality Source # |

Instance details

Defined in Numeric.Units.Dimensional.Variants

Associated Types

type Rep Metricality |
Instance details Defined in Numeric.Units.Dimensional.Variants type Rep Metricality = D1 ('MetaData "Metricality" "Numeric.Units.Dimensional.Variants" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Metric" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NonMetric" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Metricality -> Rep Metricality x Source #

to :: Rep Metricality x -> Metricality Source #

Eq Metricality Source # |
Instance details Defined in Numeric.Units.Dimensional.Variants Methods (==) :: Metricality -> Metricality -> Bool Source # (/=) :: Metricality -> Metricality -> Bool Source #
Ord Metricality Source # |

Instance details

Defined in Numeric.Units.Dimensional.Variants

Methods

compare :: Metricality -> Metricality -> Ordering Source #

(<) :: Metricality -> Metricality -> Bool Source #

(<=) :: Metricality -> Metricality -> Bool Source #

(>) :: Metricality -> Metricality -> Bool Source #

(>=) :: Metricality -> Metricality -> Bool Source #

max :: Metricality -> Metricality -> Metricality Source #

min :: Metricality -> Metricality -> Metricality Source #

type Rep Metricality Source # |
Instance details Defined in Numeric.Units.Dimensional.Variants type Rep Metricality = D1 ('MetaData "Metricality" "Numeric.Units.Dimensional.Variants" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Metric" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NonMetric" 'PrefixI 'False) (U1 :: Type -> Type))

# Physical Dimensions

data Dimension Source #

Represents a physical dimension in the basis of the 7 SI base dimensions, where the respective dimensions are represented by type variables using the following convention:

- l: Length
- m: Mass
- t: Time
- i: Electric current
- th: Thermodynamic temperature
- n: Amount of substance
- j: Luminous intensity

For the equivalent term-level representation, see `Dimension'`

Constructors

Dim TypeInt TypeInt TypeInt TypeInt TypeInt TypeInt TypeInt |

#### Instances

Instances details

(KnownTypeInt l, KnownTypeInt m, KnownTypeInt t, KnownTypeInt i, KnownTypeInt th, KnownTypeInt n, KnownTypeInt j) => HasDimension (Proxy ('Dim l m t i th n j)) Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TypeLevel Methods dimension :: Proxy ('Dim l m t i th n j) -> Dimension' Source #
(KnownTypeInt l, KnownTypeInt m, KnownTypeInt t, KnownTypeInt i, KnownTypeInt th, KnownTypeInt n, KnownTypeInt j) => HasDynamicDimension (Proxy ('Dim l m t i th n j)) Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TypeLevel Methods dynamicDimension :: Proxy ('Dim l m t i th n j) -> DynamicDimension Source #

## Dimension Arithmetic

type family (a :: Dimension) * (b :: Dimension) :: Dimension where ... infixl 7 Source #

Multiplication of dimensions corresponds to addition of the base dimensions' exponents.

Equations

DOne * d = d |
d * DOne = d |
('Dim l m t i th n j) * ('Dim l' m' t' i' th' n' j') = 'Dim (l + l') (m + m') (t + t') (i + i') (th + th') (n + n') (j + j') |

type family (a :: Dimension) / (d :: Dimension) :: Dimension where ... infixl 7 Source #

Division of dimensions corresponds to subtraction of the base dimensions' exponents.

Equations

d / DOne = d |
d / d = DOne |
('Dim l m t i th n j) / ('Dim l' m' t' i' th' n' j') = 'Dim (l - l') (m - m') (t - t') (i - i') (th - th') (n - n') (j - j') |

type family (d :: Dimension) ^ (x :: TypeInt) :: Dimension where ... infixr 8 Source #

Powers of dimensions correspond to multiplication of the base dimensions' exponents by the exponent.

We limit ourselves to integer powers of Dimensionals as fractional powers make little physical sense.

Equations

DOne ^ x = DOne |
d ^ 'Zero = DOne |
d ^ 'Pos1 = d |
('Dim l m t i th n j) ^ x = 'Dim (l * x) (m * x) (t * x) (i * x) (th * x) (n * x) (j * x) |

type family NRoot (d :: Dimension) (x :: TypeInt) :: Dimension where ... Source #

Roots of dimensions correspond to division of the base dimensions' exponents by the order of the root.

Equations

NRoot DOne x = DOne |
NRoot d 'Pos1 = d |
NRoot ('Dim l m t i th n j) x = 'Dim (l / x) (m / x) (t / x) (i / x) (th / x) (n / x) (j / x) |

type Recip (d :: Dimension) = DOne / d Source #

The reciprocal of a dimension is defined as the result of dividing `DOne` by it, or of negating each of the base dimensions' exponents.

## Term Level Representation of Dimensions

data Dimension' Source #

A physical dimension, encoded as 7 integers, representing a factorization of the dimension into the 7 SI base dimensions. By convention they are stored in the same order as in the `Dimension` data kind.

Constructors

Dim' !Int !Int !Int !Int !Int !Int !Int |

#### Instances

Instances details

NFData Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods rnf :: Dimension' -> () Source #
HasDimension Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods dimension :: Dimension' -> Dimension' Source #
HasDynamicDimension Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods dynamicDimension :: Dimension' -> DynamicDimension Source #
Monoid Dimension' Source # | The monoid of dimensions under multiplication.
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods mempty :: Dimension' Source # mappend :: Dimension' -> Dimension' -> Dimension' Source # mconcat :: [Dimension'] -> Dimension' Source #
Semigroup Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods (<>) :: Dimension' -> Dimension' -> Dimension' Source # sconcat :: NonEmpty Dimension' -> Dimension' Source # stimes :: Integral b => b -> Dimension' -> Dimension' Source #
Data Dimension' Source # |

Instance details

Defined in Numeric.Units.Dimensional.Dimensions.TermLevel

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Dimension' -> c Dimension' Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Dimension' Source #

toConstr :: Dimension' -> Constr Source #

dataTypeOf :: Dimension' -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Dimension') Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dimension') Source #

gmapT :: (forall b. Data b => b -> b) -> Dimension' -> Dimension' Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Dimension' -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Dimension' -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Dimension' -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Dimension' -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Dimension' -> m Dimension' Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Dimension' -> m Dimension' Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Dimension' -> m Dimension' Source #

Generic Dimension' Source # |

Instance details

Defined in Numeric.Units.Dimensional.Dimensions.TermLevel

Associated Types

type Rep Dimension' |

Instance details

Defined in Numeric.Units.Dimensional.Dimensions.TermLevel

type Rep Dimension' = D1 ('MetaData "Dimension'" "Numeric.Units.Dimensional.Dimensions.TermLevel" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Dim'" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) :*: ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))))

Methods

from :: Dimension' -> Rep Dimension' x Source #

to :: Rep Dimension' x -> Dimension' Source #

Show Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods showsPrec :: Int -> Dimension' -> ShowS Source # show :: Dimension' -> String Source # showList :: [Dimension'] -> ShowS Source #
Eq Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods (==) :: Dimension' -> Dimension' -> Bool Source # (/=) :: Dimension' -> Dimension' -> Bool Source #
Ord Dimension' Source # |

Instance details

Defined in Numeric.Units.Dimensional.Dimensions.TermLevel

Methods

compare :: Dimension' -> Dimension' -> Ordering Source #

(<) :: Dimension' -> Dimension' -> Bool Source #

(<=) :: Dimension' -> Dimension' -> Bool Source #

(>) :: Dimension' -> Dimension' -> Bool Source #

(>=) :: Dimension' -> Dimension' -> Bool Source #

max :: Dimension' -> Dimension' -> Dimension' Source #

min :: Dimension' -> Dimension' -> Dimension' Source #

type Rep Dimension' Source # |

Instance details

Defined in Numeric.Units.Dimensional.Dimensions.TermLevel

type Rep Dimension' = D1 ('MetaData "Dimension'" "Numeric.Units.Dimensional.Dimensions.TermLevel" "dimensional-1.6.1-DmNxHObAeML5uhkkhNUdgI" 'False) (C1 ('MetaCons "Dim'" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) :*: ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))))

class HasDynamicDimension a => HasDimension a where Source #

Dimensional values inhabit this class, which allows access to a term-level representation of their dimension.

Methods

dimension :: a -> Dimension' Source #

Obtains a term-level representation of a value's dimension.

#### Instances

Instances details

HasDimension Dimension' Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods dimension :: Dimension' -> Dimension' Source #
HasDimension AnyUnit Source # |
Instance details Defined in Numeric.Units.Dimensional.Dynamic Methods dimension :: AnyUnit -> Dimension' Source #
HasDimension (AnyQuantity a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Dynamic Methods dimension :: AnyQuantity a -> Dimension' Source #
(KnownTypeInt l, KnownTypeInt m, KnownTypeInt t, KnownTypeInt i, KnownTypeInt th, KnownTypeInt n, KnownTypeInt j) => HasDimension (Proxy ('Dim l m t i th n j)) Source # |
Instance details Defined in Numeric.Units.Dimensional.Dimensions.TypeLevel Methods dimension :: Proxy ('Dim l m t i th n j) -> Dimension' Source #
KnownDimension d => HasDimension (Dimensional v d a) Source # |
Instance details Defined in Numeric.Units.Dimensional.Internal Methods dimension :: Dimensional v d a -> Dimension' Source #

type KnownDimension (d :: Dimension) = HasDimension (Proxy d) Source #

A KnownDimension is one for which we can construct a term-level representation. Each validly constructed type of kind `Dimension` has a `KnownDimension` instance.

While `KnownDimension` is a constraint synonym, the presence of ``KnownDimension` d` in a context allows use of ``dimension` :: `Proxy` d -> `Dimension'``.

# Dimensional Arithmetic

(*~) :: forall (s :: ExactPi') (m :: Metricality) (d :: Dimension) a b. (RealFrac a, Integral b, MinCtxt s a) => a -> Unit m d a -> SQuantity s d b infixl 7 Source #

Forms a possibly scaled `SQuantity` by multipliying a number and a unit.

(/~) :: forall (s :: ExactPi') (m :: Metricality) (d :: Dimension) a b. (Real a, Fractional b, MinCtxt s b) => SQuantity s d a -> Unit m d b -> b infixl 7 Source #

Divides a possibly scaled `SQuantity` by a `Unit` of the same physical dimension, obtaining the numerical value of the quantity expressed in that unit.

(*) :: forall (v1 :: Variant) (v2 :: Variant) a (d1 :: Dimension) (d2 :: Dimension). (KnownVariant v1, KnownVariant v2, KnownVariant (v1 * v2), Num a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 * v2) (d1 * d2) a infixl 7 Source #

Multiplies two `Quantity`s or two `Unit`s.

The intimidating type signature captures the similarity between these operations and ensures that composite `Unit`s are `NonMetric`.

(/) :: forall (v1 :: Variant) (v2 :: Variant) a (d1 :: Dimension) (d2 :: Dimension). (KnownVariant v1, KnownVariant v2, KnownVariant (v1 / v2), Fractional a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 / v2) (d1 / d2) a infixl 7 Source #

Divides one `Quantity` by another or one `Unit` by another.

The intimidating type signature captures the similarity between these operations and ensures that composite `Unit`s are `NonMetric`.

(+) :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a -> SQuantity s d a infixl 6 Source #

Adds two possibly scaled `SQuantity`s, preserving any scale factor.

Use in conjunction with `changeRepRound` to combine quantities with differing scale factors.

(-) :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a -> SQuantity s d a infixl 6 Source #

Subtracts one possibly scaled `SQuantity` from another, preserving any scale factor.

Use in conjunction with `changeRepRound` to combine quantities with differing scale factors.

negate :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a Source #

Negates the value of a possibly scaled `SQuantity`, preserving any scale factor.

abs :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a -> SQuantity s d a Source #

Takes the absolute value of a possibly scaled `SQuantity`, preserving any scale factor.

## Transcendental Functions

### Via `Double`

expD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

logD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

sinD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

cosD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

tanD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

asinD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

acosD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

atanD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

sinhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

coshD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

tanhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

asinhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

acoshD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

atanhD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b Source #

atan2D :: forall a b (s1 :: ExactPi') (s2 :: ExactPi') (s3 :: ExactPi'). (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double, MinCtxt s3 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne a -> SQuantity s3 DOne b Source #

The standard two argument arctangent function. Since it interprets its two arguments in comparison with one another, the input may have any dimension.

### Via arbitary `Floating` type

expVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

logVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

sinVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

cosVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

tanVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

asinVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

acosVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

atanVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

sinhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

coshVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

tanhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

asinhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

acoshVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

atanhVia :: forall a b c (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c Source #

atan2Via :: forall (s1 :: ExactPi') (s2 :: ExactPi') (s3 :: ExactPi') a b c (d :: Dimension). (Integral a, RealFloat b, Integral c, MinCtxt s1 b, MinCtxt s2 b, MinCtxt s3 b, KnownDimension d) => Proxy b -> SQuantity s1 d a -> SQuantity s2 d a -> SQuantity s3 DOne c Source #

The standard two argument arctangent function. Since it interprets its two arguments in comparison with one another, the input may have any dimension.

## Operations on Collections

(*~~) :: forall f a b (s :: ExactPi') (m :: Metricality) (d :: Dimension). (Functor f, RealFrac a, Integral b, MinCtxt s a) => f a -> Unit m d a -> f (SQuantity s d b) infixl 7 Source #

Applies `*~` to all values in a functor.

(/~~) :: forall f a b (s :: ExactPi') (d :: Dimension) (m :: Metricality). (Functor f, Real a, Fractional b, MinCtxt s b) => f (SQuantity s d a) -> Unit m d b -> f b infixl 7 Source #

Applies `/~` to all values in a functor.

sum :: forall a f (s :: ExactPi') (d :: Dimension). (Num a, Foldable f) => f (SQuantity s d a) -> SQuantity s d a Source #

The sum of all elements in a list.

mean :: forall a f (s :: ExactPi') (d :: Dimension). (Fractional a, Foldable f) => f (SQuantity s d a) -> SQuantity s d a Source #

The arithmetic mean of all elements in a list.

## Conversion Between Representations

rescale :: forall a b (d :: Dimension) (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, Integral b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b Source #

Rescales a fixed point quantity, accomodating changes both in its scale factor and its representation type.

Note that this uses an arbitrary precision representation of `pi`, which may be quite slow.

rescaleFinite :: forall a b (s1 :: ExactPi') (s2 :: ExactPi') (d :: Dimension). (Integral a, FiniteBits a, Integral b, FiniteBits b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b Source #

Rescales a fixed point quantity, accomodating changes both in its scale factor and its representation type.

Expected to outperform `rescale` when a `FiniteBits` context is available for the source and destination representation types.

rescaleD :: forall a b (s1 :: ExactPi') (s2 :: ExactPi') (d :: Dimension). (Integral a, Integral b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b Source #

Approximately rescales a fixed point quantity, accomodating changes both in its scale factor and its representation type.

Uses approximate arithmetic by way of an intermediate `Double` representation.

rescaleVia :: forall a b c (d :: Dimension) (s1 :: ExactPi') (s2 :: ExactPi'). (Integral a, RealFrac b, Floating b, Integral c, KnownExactPi s1, KnownExactPi s2) => Proxy b -> SQuantity s1 d a -> SQuantity s2 d c Source #

Approximately rescales a fixed point quantity, accomodating changes both in its scale factor and its representation type.

Uses approximate arithmetic by way of an intermediate `Floating` type, to which a proxy must be supplied.

class KnownVariant (v :: Variant) where Source #

A KnownVariant is one whose term-level `Dimensional` values we can represent with an associated data family instance and manipulate with certain functions, not all of which are exported from the package.

Each validly constructed type of kind `Variant` has a `KnownVariant` instance.

Minimal complete definition

extractValue, extractName, injectValue, dmap

Methods

dmap :: forall a1 a2 (d :: Dimension). (a1 -> a2) -> Dimensional v d a1 -> Dimensional v d a2 Source #

Maps over the underlying representation of a dimensional value. The caller is responsible for ensuring that the supplied function respects the dimensional abstraction. This means that the function must preserve numerical values, or linearly scale them while preserving the origin.

#### Instances

Instances details

KnownVariant ('DQuantity s) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Associated Types

newtype Dimensional ('DQuantity s) d a |
Instance details Defined in Numeric.Units.Dimensional.Internal newtype Dimensional ('DQuantity s) d a = Quantity a

Methods

extractValue :: forall (d :: Dimension) a. Dimensional ('DQuantity s) d a -> (a, Maybe ExactPi)

extractName :: forall (d :: Dimension) a. Dimensional ('DQuantity s) d a -> Maybe (UnitName 'NonMetric)

injectValue :: forall a (d :: Dimension). Maybe (UnitName 'NonMetric) -> (a, Maybe ExactPi) -> Dimensional ('DQuantity s) d a

dmap :: forall a1 a2 (d :: Dimension). (a1 -> a2) -> Dimensional ('DQuantity s) d a1 -> Dimensional ('DQuantity s) d a2 Source #

Typeable m => KnownVariant ('DUnit m) Source # |

Instance details

Defined in Numeric.Units.Dimensional.Internal

Associated Types

data Dimensional ('DUnit m) d a |
Instance details Defined in Numeric.Units.Dimensional.Internal data Dimensional ('DUnit m) d a = Unit !(UnitName m) !ExactPi !a

Methods

extractValue :: forall (d :: Dimension) a. Dimensional ('DUnit m) d a -> (a, Maybe ExactPi)

extractName :: forall (d :: Dimension) a. Dimensional ('DUnit m) d a -> Maybe (UnitName 'NonMetric)

injectValue :: forall a (d :: Dimension). Maybe (UnitName 'NonMetric) -> (a, Maybe ExactPi) -> Dimensional ('DUnit m) d a

dmap :: forall a1 a2 (d :: Dimension). (a1 -> a2) -> Dimensional ('DUnit m) d a1 -> Dimensional ('DUnit m) d a2 Source #

changeRep :: forall (v1 :: Variant) (v2 :: Variant) (d :: Dimension) a b. (KnownVariant v1, KnownVariant v2, CompatibleVariants v1 v2, MinCtxt (ScaleFactor v1 / ScaleFactor v2) b, Real a, Fractional b) => Dimensional v1 d a -> Dimensional v2 d b Source #

Convenient conversion between numerical types while retaining dimensional information.

changeRepRound :: forall (v1 :: Variant) (v2 :: Variant) (d :: Dimension) a b. (KnownVariant v1, KnownVariant v2, CompatibleVariants v1 v2, MinCtxt (ScaleFactor v1 / ScaleFactor v2) a, RealFrac a, Integral b) => Dimensional v1 d a -> Dimensional v2 d b Source #

Convenient conversion to types with `Integral` representations using `round`.

changeRepApproximate :: forall (v :: Variant) b (d :: Dimension). (KnownVariant v, Floating b) => Dimensional v d ExactPi -> Dimensional v d b Source #

Convenient conversion from exactly represented values while retaining dimensional information.

# Dimension Synonyms

type DOne = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero Source #

The type-level dimension of dimensionless values.

type DLength = 'Dim 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero Source #

type DMass = 'Dim 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero Source #

type DTime = 'Dim 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero Source #

type DElectricCurrent = 'Dim 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero Source #

type DThermodynamicTemperature = 'Dim 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero Source #

type DAmountOfSubstance = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero Source #

type DLuminousIntensity = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 Source #

# Quantity Synonyms

type Dimensionless = Quantity DOne Source #

type Length = Quantity DLength Source #

type Mass = Quantity DMass Source #

type Time = Quantity DTime Source #

type ElectricCurrent = Quantity DElectricCurrent Source #

type ThermodynamicTemperature = Quantity DThermodynamicTemperature Source #

type AmountOfSubstance = Quantity DAmountOfSubstance Source #

type LuminousIntensity = Quantity DLuminousIntensity Source #

# Constants

_0 :: forall a (s :: ExactPi') (d :: Dimension). Num a => SQuantity s d a Source #

The constant for zero is polymorphic, allowing it to express zero `Length` or `Capacitance` or `Velocity` etc, in addition to the `Dimensionless` value zero.

epsilon :: forall a (s :: ExactPi') (d :: Dimension). Integral a => SQuantity s d a Source #

The smallest positive representable value in a given fixed-point scaled quantity type.

Note that, other than `_0` and `epsilon`, these constants may not be exactly representable with certain scale factors.

_1 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_2 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_3 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_4 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_5 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_6 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_7 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_8 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

_9 :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

pi :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

tau :: forall a (s :: ExactPi'). (Integral a, KnownExactPi s) => SQuantity s DOne a Source #

Twice `pi`.

For background on `tau` see The Tau Manifesto (but also feel free to review The Pi Manifesto).

# Constructing Units

siUnit :: forall (d :: Dimension) a. (KnownDimension d, Num a) => Unit 'NonMetric d a Source #

A polymorphic `Unit` which can be used in place of the coherent SI base unit of any dimension. This allows polymorphic quantity creation and destruction without exposing the `Dimensional` constructor.

one :: Num a => Unit 'NonMetric DOne a Source #

The unit `one` has dimension `DOne` and is the base unit of dimensionless values.

As detailed in 7.10 "Values of quantities expressed simply as numbers: the unit one, symbol 1" of [1], the unit one generally does not appear in expressions. However, for us it is necessary to use `one` as we would any other unit to perform the "wrapping" of dimensionless values.

mkUnitR :: forall a (m :: Metricality) (m1 :: Metricality) (d :: Dimension). Floating a => UnitName m -> ExactPi -> Unit m1 d a -> Unit m d a Source #

Forms a new atomic `Unit` by specifying its `UnitName` and its definition as a multiple of another `Unit`.

Use this variant when the scale factor of the resulting unit is irrational or `Approximate`. See `mkUnitQ` for when it is rational and `mkUnitZ` for when it is an integer.

Note that supplying zero as a definining quantity is invalid, as the library relies upon units forming a group under multiplication.

Supplying negative defining quantities is allowed and handled gracefully, but is discouraged on the grounds that it may be unexpected by other readers.

mkUnitQ :: forall a (m :: Metricality) (m1 :: Metricality) (d :: Dimension). Fractional a => UnitName m -> Rational -> Unit m1 d a -> Unit m d a Source #

Forms a new atomic `Unit` by specifying its `UnitName` and its definition as a multiple of another `Unit`.

Use this variant when the scale factor of the resulting unit is rational. See `mkUnitZ` for when it is an integer and `mkUnitR` for the general case.

For more information see `mkUnitR`.

mkUnitZ :: forall a (m :: Metricality) (m1 :: Metricality) (d :: Dimension). Num a => UnitName m -> Integer -> Unit m1 d a -> Unit m d a Source #

Forms a new atomic `Unit` by specifying its `UnitName` and its definition as a multiple of another `Unit`.

Use this variant when the scale factor of the resulting unit is an integer. See `mkUnitQ` for when it is rational and `mkUnitR` for the general case.

For more information see `mkUnitR`.

# Unit Metadata

name :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> UnitName m Source #

Extracts the `UnitName` of a `Unit`.

exactValue :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> ExactPi Source #

Extracts the exact value of a `Unit`, expressed in terms of the SI coherent derived unit (see `siUnit`) of the same `Dimension`.

Note that the actual value may in some cases be approximate, for example if the unit is defined by experiment.

weaken :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> Unit 'NonMetric d a Source #

Discards potentially unwanted type level information about a `Unit`.

strengthen :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> Maybe (Unit 'Metric d a) Source #

Attempts to convert a `Unit` which may or may not be `Metric` to one which is certainly `Metric`.

exactify :: forall (m :: Metricality) (d :: Dimension) a. Unit m d a -> Unit m d ExactPi Source #

Forms the exact version of a `Unit`.

# Commonly Used Type Synonyms

These type synonyms for commonly used fixed-point types are provided for convenience.

type Q (n :: Natural) a = SQuantity (QScale n) DOne a Source #

A dimensionless number with `n` fractional bits, using a representation of type `a`.

type QScale (n :: Natural) = One / ExactNatural (2 ^ n) Source #

A binary scale factor.

type Angle8 = SQuantity (Pi * QScale 7) DPlaneAngle Int8 Source #

A single-turn angle represented as a signed 8-bit integer.

type Angle16 = SQuantity (Pi * QScale 15) DPlaneAngle Int16 Source #

A single-turn angle represented as a signed 16-bit integer.

type Angle32 = SQuantity (Pi * QScale 31) DPlaneAngle Int32 Source #

A single-turn angle represented as a signed 32-bit integer.