HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduledimensional-1.5Haskell2010

Numeric.Units.Dimensional.Dimensions.TypeLevel

This module defines type-level physical dimensions expressed in terms of the SI base dimensions using Numeric.NumType.DK.NumType for type-level integers.

Type-level arithmetic, synonyms for the base dimensions, and conversion to the term-level are included.

  • 13 types
  • MonoLocalBinds
  • ScopedTypeVariables
  • TypeFamilies
  • ConstraintKinds
  • DataKinds
  • TypeSynonymInstances
  • FlexibleContexts
  • FlexibleInstances
  • KindSignatures
  • TypeOperators
  • ExplicitNamespaces
  • ExplicitForAll
  • Packagedimensional-1.5
  • Exports17
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTypeLevel.hs

Kind of Type-Level Dimensions

1 declaration
datadata Dimension
#

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'

Instances2HasDimension, HasDynamicDimension

Dimension Arithmetic

7 declarations
familytype family (*) (a :: Dimension) (b :: Dimension) :: Dimension where
#

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')
familytype family (/) (a :: Dimension) (d :: Dimension) :: Dimension where
#

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')
familytype family (^) (d :: Dimension) (x :: TypeInt) :: Dimension where
#

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

typetype Recip (d :: Dimension) = DOne / d
#

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

Synonyms for Base Dimensions

8 declarations

Conversion to Term Level

1 declaration