Copyright | Copyright (C) 2006-2015 Bjorn Buckwalter |
---|---|
License | BSD3 |
Maintainer | bjorn@buckwalter.se |
Stability | Stable |
Portability | GHC only |
Safe Haskell | Safe |
Language | Haskell2010 |
This module defines physical dimensions expressed in terms of the SI base dimensions, including arithmetic.
- data Dimension' = Dim' !Int !Int !Int !Int !Int !Int !Int
- class HasDimension a where
- dimension :: a -> Dimension'
- (*) :: Dimension' -> Dimension' -> Dimension'
- (/) :: Dimension' -> Dimension' -> Dimension'
- (^) :: Dimension' -> Int -> Dimension'
- recip :: Dimension' -> Dimension'
- dOne :: Dimension'
- dLength :: Dimension'
- dMass :: Dimension'
- dTime :: Dimension'
- dElectricCurrent :: Dimension'
- dThermodynamicTemperature :: Dimension'
- dAmountOfSubstance :: Dimension'
- dLuminousIntensity :: Dimension'
- asList :: Dimension' -> [Int]
Type
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.
Eq Dimension' Source | |
Ord Dimension' Source | |
Show Dimension' Source | |
Monoid Dimension' Source | The monoid of dimensions under multiplication. |
HasDimension Dimension' Source |
Access to Dimension of Dimensional Values
class HasDimension a where Source
Dimensional values inhabit this class, which allows access to a term-level representation of their dimension.
dimension :: a -> Dimension' Source
Obtains a term-level representation of a value's dimension.
HasDimension Dimension' Source | |
HasDimension AnyUnit Source | |
HasDimension (AnyQuantity v) Source | |
(KnownTypeInt l, KnownTypeInt m, KnownTypeInt t, KnownTypeInt i, KnownTypeInt th, KnownTypeInt n, KnownTypeInt j) => HasDimension (Proxy Dimension (Dim l m t i th n j)) Source | |
KnownDimension d => HasDimension (Dimensional v d a) Source |
Dimension Arithmetic
(*) :: Dimension' -> Dimension' -> Dimension' infixl 7 Source
Forms the product of two dimensions.
(/) :: Dimension' -> Dimension' -> Dimension' infixl 7 Source
Forms the quotient of two dimensions.
(^) :: Dimension' -> Int -> Dimension' infixr 8 Source
Raises a dimension to an integer power.
recip :: Dimension' -> Dimension' Source
Forms the reciprocal of a dimension.
Synonyms for Base Dimensions
dOne :: Dimension' Source
The dimension of dimensionless values.
Deconstruction
asList :: Dimension' -> [Int] Source
Converts a dimension to a list of 7 integers, representing the exponent associated with each of the 7 SI base dimensions in the standard order.