dimensional-1.0.1.3: Statically checked physical dimensions, using Type Families and Data Kinds.

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

Numeric.Units.Dimensional.Dimensions.TermLevel

Contents

- Type
- Access to Dimension of Dimensional Values
- Dimension Arithmetic
- Synonyms for Base Dimensions
- Deconstruction

Description

This module defines physical dimensions expressed in terms of the SI base dimensions, including arithmetic.

Synopsis

- data Dimension' = Dim' !Int !Int !Int !Int !Int !Int !Int
- class HasDimension a where
- (*) :: 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.

Constructors

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

Instances

Eq Dimension' Source # |
Methods (==) :: Dimension' -> Dimension' -> Bool # (/=) :: Dimension' -> Dimension' -> Bool #
Ord Dimension' Source # |
Methods compare :: Dimension' -> Dimension' -> Ordering # (<) :: Dimension' -> Dimension' -> Bool # (<=) :: Dimension' -> Dimension' -> Bool # (>) :: Dimension' -> Dimension' -> Bool # (>=) :: Dimension' -> Dimension' -> Bool # max :: Dimension' -> Dimension' -> Dimension' # min :: Dimension' -> Dimension' -> Dimension' #
Show Dimension' Source # |
Methods showsPrec :: Int -> Dimension' -> ShowS # show :: Dimension' -> String # showList :: [Dimension'] -> ShowS #
Monoid Dimension' Source # | The monoid of dimensions under multiplication.
Methods mempty :: Dimension' # mappend :: Dimension' -> Dimension' -> Dimension' # mconcat :: [Dimension'] -> Dimension' #
HasDimension Dimension' Source # |
Methods dimension :: Dimension' -> 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.

Minimal complete definition

dimension

Methods

dimension :: a -> Dimension' Source #

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

Instances

HasDimension Dimension' Source # |
Methods dimension :: Dimension' -> Dimension' Source #
HasDimension AnyUnit Source # |
Methods dimension :: AnyUnit -> Dimension' Source #
HasDimension (AnyQuantity v) Source # |
Methods dimension :: AnyQuantity v -> Dimension' 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 # |
Methods dimension :: Proxy Dimension (Dim l m t i th n j) -> Dimension' Source #
KnownDimension d => HasDimension (Dimensional v d a) Source # |
Methods dimension :: Dimensional v d a -> Dimension' 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.

dLength :: Dimension' Source #

dMass :: Dimension' Source #

dTime :: Dimension' Source #

dElectricCurrent :: Dimension' Source #

dThermodynamicTemperature :: Dimension' Source #

dAmountOfSubstance :: Dimension' Source #

dLuminousIntensity :: Dimension' Source #

# 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.