| Copyright | Copyright (C) 2006-2018 Bjorn Buckwalter | 
|---|---|
| License | BSD3 | 
| Maintainer | bjorn@buckwalter.se | 
| Stability | Stable | 
| Portability | GHC only | 
| Safe Haskell | Safe | 
| Language | Haskell2010 | 
Numeric.Units.Dimensional.Dimensions
Description
Provides both term-level and type-level representations for physical dimensions in a single import for convenience.
Presuming that users intend to work primarily with type level dimensions, this module hides arithmetic operators over term level dimensions and aliases for the base term-level dimensions to avoid namespace pollution. These features are available directly from Numeric.Units.Dimensional.Dimensions.TermLevel if desired.
Synopsis
- class HasDynamicDimension a => HasDimension a where
- dimension :: a -> Dimension'
 
 - class HasDynamicDimension a where
- dynamicDimension :: a -> DynamicDimension
 
 - data DynamicDimension
 - data Dimension' = Dim' !Int !Int !Int !Int !Int !Int !Int
 - matchDimensions :: DynamicDimension -> DynamicDimension -> DynamicDimension
 - isCompatibleWith :: HasDynamicDimension a => a -> Dimension' -> Bool
 - hasSomeDimension :: HasDynamicDimension a => a -> Bool
 - dOne :: Dimension'
 - asList :: Dimension' -> [Int]
 - module Numeric.Units.Dimensional.Dimensions.TypeLevel
 
Documentation
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
| HasDimension Dimension' Source # | |
Defined in Numeric.Units.Dimensional.Dimensions.TermLevel Methods dimension :: Dimension' -> Dimension' Source #  | |
| HasDimension AnyUnit Source # | |
Defined in Numeric.Units.Dimensional.Dynamic Methods dimension :: AnyUnit -> Dimension' Source #  | |
| HasDimension (AnyQuantity a) Source # | |
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 # | |
| KnownDimension d => HasDimension (Dimensional v d a) Source # | |
Defined in Numeric.Units.Dimensional.Internal Methods dimension :: Dimensional v d a -> Dimension' Source #  | |
class HasDynamicDimension a where Source #
Dimensional values, or those that are only possibly dimensional, inhabit this class, which allows access to a term-level representation of their dimension.
Minimal complete definition
Nothing
Methods
dynamicDimension :: a -> DynamicDimension Source #
Gets the 'DynamicDimension of a dynamic dimensional value, which may be NoDimension if it does not represent
 a dimensional value of any Dimension.
A default implementation is available for types that are also in the HasDimension typeclass.
dynamicDimension :: HasDimension a => a -> DynamicDimension Source #
Gets the 'DynamicDimension of a dynamic dimensional value, which may be NoDimension if it does not represent
 a dimensional value of any Dimension.
A default implementation is available for types that are also in the HasDimension typeclass.
Instances
data DynamicDimension Source #
The dimension of a dynamic value, which may not have any dimension at all.
Constructors
| NoDimension | The value has no valid dimension.  | 
| SomeDimension Dimension' | The value has the given dimension.  | 
| AnyDimension | The value may be interpreted as having any dimension.  | 
Instances
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.
Instances
matchDimensions :: DynamicDimension -> DynamicDimension -> DynamicDimension Source #
Combines two DynamicDimensions, determining the DynamicDimension of a quantity that must
 match both inputs.
This is the lattice meet operation for DynamicDimension.
isCompatibleWith :: HasDynamicDimension a => a -> Dimension' -> Bool Source #
Determines if a value that has a DynamicDimension is compatible with a specified Dimension'.
hasSomeDimension :: HasDynamicDimension a => a -> Bool Source #
Determines if a value that has a DynamicDimension in fact has any valid dimension at all.
dOne :: Dimension' Source #
The dimension of dimensionless values.
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.