HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduledimensional-1.6.2Haskell2010

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.

  • MonoLocalBinds
  • ScopedTypeVariables
  • TypeFamilies
  • ConstraintKinds
  • DataKinds
  • TypeSynonymInstances
  • FlexibleContexts
  • FlexibleInstances
  • KindSignatures
  • TypeOperators
  • ExplicitNamespaces
  • ExplicitForAll
Contents
  1. Kind of Type-Level Dimensions
  2. Dimension Arithmetic
  3. Synonyms for Base Dimensions
  4. Conversion to Term Level
Synopsis
  • Packagedimensional-1.6.2
  • Exports17
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTypeLevel.hs

Kind of Type-Level Dimensions

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

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

Conversion to Term Level