-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Statically checked physical dimensions,
--   using Type Families and Data Kinds.
--   
--   Dimensional is a library providing data types for performing
--   arithmetic with physical quantities and units. Information about the
--   physical dimensions of the quantities and units is embedded in their
--   types and the validity of operations is verified by the type checker
--   at compile time. The boxing and unboxing of numerical values as
--   quantities is done by multiplication and division with units. The
--   library is designed to, as far as is practical, enforce/encourage best
--   practices of unit usage. Version 1 of the dimensional package differs
--   from earlier version in that the dimension tracking is implemented
--   using Closed Type Families and Data Kinds rather than functional
--   dependencies. This enables a number of features, including improved
--   support for unit names and quantities with statically-unknown
--   dimensions. Requires GHC 8.0 or later.
@package dimensional
@version 1.3


-- | This module defines physical dimensions expressed in terms of the SI
--   base dimensions, including arithmetic.
module Numeric.Units.Dimensional.Dimensions.TermLevel

-- | 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
--   <a>Dimension</a> data kind.
data Dimension'
Dim' :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> Dimension'

-- | Dimensional values inhabit this class, which allows access to a
--   term-level representation of their dimension.
class HasDynamicDimension a => HasDimension a

-- | Obtains a term-level representation of a value's dimension.
dimension :: HasDimension a => a -> Dimension'

-- | Dimensional values, or those that are only possibly dimensional,
--   inhabit this class, which allows access to a term-level representation
--   of their dimension.
class HasDynamicDimension a

-- | Gets the 'DynamicDimension of a dynamic dimensional value, which may
--   be <a>NoDimension</a> if it does not represent a dimensional value of
--   any <tt>Dimension</tt>.
--   
--   A default implementation is available for types that are also in the
--   <a>HasDimension</a> typeclass.
dynamicDimension :: HasDynamicDimension a => a -> DynamicDimension

-- | Gets the 'DynamicDimension of a dynamic dimensional value, which may
--   be <a>NoDimension</a> if it does not represent a dimensional value of
--   any <tt>Dimension</tt>.
--   
--   A default implementation is available for types that are also in the
--   <a>HasDimension</a> typeclass.
dynamicDimension :: (HasDynamicDimension a, HasDimension a) => a -> DynamicDimension

-- | The dimension of a dynamic value, which may not have any dimension at
--   all.
data DynamicDimension

-- | The value has no valid dimension.
NoDimension :: DynamicDimension

-- | The value has the given dimension.
SomeDimension :: Dimension' -> DynamicDimension

-- | The value may be interpreted as having any dimension.
AnyDimension :: DynamicDimension

-- | Forms the product of two dimensions.
(*) :: Dimension' -> Dimension' -> Dimension'
infixl 7 *

-- | Forms the quotient of two dimensions.
(/) :: Dimension' -> Dimension' -> Dimension'
infixl 7 /

-- | Raises a dimension to an integer power.
(^) :: Dimension' -> Int -> Dimension'
infixr 8 ^

-- | Forms the reciprocal of a dimension.
recip :: Dimension' -> Dimension'

-- | Takes the nth root of a dimension, if it exists.
--   
--   n must not be zero.
--   
--   <pre>
--   nroot (negate n) d == nroot n (recip d)
--   </pre>
nroot :: Int -> Dimension' -> Maybe Dimension'

-- | Takes the square root of a dimension, if it exists.
--   
--   <pre>
--   sqrt d == nroot 2 d
--   </pre>
sqrt :: Dimension' -> Maybe Dimension'

-- | Takes the cube root of a dimension, if it exists.
--   
--   <pre>
--   cbrt d == nroot 3 d
--   </pre>
cbrt :: Dimension' -> Maybe Dimension'

-- | The dimension of dimensionless values.
dOne :: Dimension'
dLength :: Dimension'
dMass :: Dimension'
dTime :: Dimension'
dElectricCurrent :: Dimension'
dThermodynamicTemperature :: Dimension'
dAmountOfSubstance :: Dimension'
dLuminousIntensity :: Dimension'

-- | 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.
asList :: Dimension' -> [Int]

-- | Combines two <a>DynamicDimension</a>s, determining the
--   <a>DynamicDimension</a> of a quantity that must match both inputs.
--   
--   This is the lattice meet operation for <a>DynamicDimension</a>.
matchDimensions :: DynamicDimension -> DynamicDimension -> DynamicDimension

-- | Determines if a value that has a <a>DynamicDimension</a> is compatible
--   with a specified <a>Dimension'</a>.
isCompatibleWith :: HasDynamicDimension a => a -> Dimension' -> Bool

-- | Determines if a value that has a <a>DynamicDimension</a> in fact has
--   any valid dimension at all.
hasSomeDimension :: HasDynamicDimension a => a -> Bool
instance GHC.Generics.Generic Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance Data.Data.Data Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance GHC.Show.Show Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance GHC.Classes.Ord Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance GHC.Classes.Eq Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance GHC.Generics.Generic Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance Data.Data.Data Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance GHC.Classes.Ord Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance GHC.Classes.Eq Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance GHC.Show.Show Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDynamicDimension Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDynamicDimension Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDimension Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance Control.DeepSeq.NFData Numeric.Units.Dimensional.Dimensions.TermLevel.DynamicDimension
instance Control.DeepSeq.NFData Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance GHC.Base.Semigroup Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'
instance GHC.Base.Monoid Numeric.Units.Dimensional.Dimensions.TermLevel.Dimension'


-- | This module defines type-level physical dimensions expressed in terms
--   of the SI base dimensions using <a>NumType</a> for type-level
--   integers.
--   
--   Type-level arithmetic, synonyms for the base dimensions, and
--   conversion to the term-level are included.
module Numeric.Units.Dimensional.Dimensions.TypeLevel

-- | 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:
--   
--   <ul>
--   <li>l: Length</li>
--   <li>m: Mass</li>
--   <li>t: Time</li>
--   <li>i: Electric current</li>
--   <li>th: Thermodynamic temperature</li>
--   <li>n: Amount of substance</li>
--   <li>j: Luminous intensity</li>
--   </ul>
--   
--   For the equivalent term-level representation, see <a>Dimension'</a>
data Dimension
Dim :: TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> Dimension

-- | Multiplication of dimensions corresponds to adding of the base
--   dimensions' exponents.
type family (a :: Dimension) * (b :: Dimension)
infixl 7 *

-- | Division of dimensions corresponds to subtraction of the base
--   dimensions' exponents.
type family (a :: Dimension) / (d :: Dimension)
infixl 7 /

-- | Powers of dimensions corresponds 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.
type family (d :: Dimension) ^ (x :: TypeInt)
infixr 8 ^

-- | The reciprocal of a dimension is defined as the result of dividing
--   <a>DOne</a> by it, or of negating each of the base dimensions'
--   exponents.
type Recip (d :: Dimension) = DOne / d

-- | Roots of dimensions corresponds to division of the base dimensions'
--   exponents by the order of the root.
type family NRoot (d :: Dimension) (x :: TypeInt)

-- | Square root is a special case of <a>NRoot</a> with order 2.
type Sqrt d = NRoot d 'Pos2

-- | Cube root is a special case of <a>NRoot</a> with order 3.
type Cbrt d = NRoot d 'Pos3

-- | The type-level dimension of dimensionless values.
type DOne = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DLength = 'Dim 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DMass = 'Dim 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DTime = 'Dim 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero
type DElectricCurrent = 'Dim 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
type DThermodynamicTemperature = 'Dim 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero
type DAmountOfSubstance = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero
type DLuminousIntensity = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1

-- | A KnownDimension is one for which we can construct a term-level
--   representation. Each validly constructed type of kind <a>Dimension</a>
--   has a <a>KnownDimension</a> instance.
--   
--   While <a>KnownDimension</a> is a constraint synonym, the presence of
--   <tt><a>KnownDimension</a> d</tt> in a context allows use of
--   <tt><a>dimension</a> :: <a>Proxy</a> d -&gt; <a>Dimension'</a></tt>.
type KnownDimension (d :: Dimension) = HasDimension (Proxy d)
instance (Numeric.NumType.DK.Integers.KnownTypeInt l, Numeric.NumType.DK.Integers.KnownTypeInt m, Numeric.NumType.DK.Integers.KnownTypeInt t, Numeric.NumType.DK.Integers.KnownTypeInt i, Numeric.NumType.DK.Integers.KnownTypeInt th, Numeric.NumType.DK.Integers.KnownTypeInt n, Numeric.NumType.DK.Integers.KnownTypeInt j) => Numeric.Units.Dimensional.Dimensions.TermLevel.HasDynamicDimension (Data.Proxy.Proxy ('Numeric.Units.Dimensional.Dimensions.TypeLevel.Dim l m t i th n j))
instance (Numeric.NumType.DK.Integers.KnownTypeInt l, Numeric.NumType.DK.Integers.KnownTypeInt m, Numeric.NumType.DK.Integers.KnownTypeInt t, Numeric.NumType.DK.Integers.KnownTypeInt i, Numeric.NumType.DK.Integers.KnownTypeInt th, Numeric.NumType.DK.Integers.KnownTypeInt n, Numeric.NumType.DK.Integers.KnownTypeInt j) => Numeric.Units.Dimensional.Dimensions.TermLevel.HasDimension (Data.Proxy.Proxy ('Numeric.Units.Dimensional.Dimensions.TypeLevel.Dim l m t i th n j))


-- | 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
--   <a>Numeric.Units.Dimensional.Dimensions.TermLevel</a> if desired.
module Numeric.Units.Dimensional.Dimensions

-- | Dimensional values inhabit this class, which allows access to a
--   term-level representation of their dimension.
class HasDynamicDimension a => HasDimension a

-- | Obtains a term-level representation of a value's dimension.
dimension :: HasDimension a => a -> Dimension'

-- | Dimensional values, or those that are only possibly dimensional,
--   inhabit this class, which allows access to a term-level representation
--   of their dimension.
class HasDynamicDimension a

-- | Gets the 'DynamicDimension of a dynamic dimensional value, which may
--   be <a>NoDimension</a> if it does not represent a dimensional value of
--   any <tt>Dimension</tt>.
--   
--   A default implementation is available for types that are also in the
--   <a>HasDimension</a> typeclass.
dynamicDimension :: HasDynamicDimension a => a -> DynamicDimension

-- | Gets the 'DynamicDimension of a dynamic dimensional value, which may
--   be <a>NoDimension</a> if it does not represent a dimensional value of
--   any <tt>Dimension</tt>.
--   
--   A default implementation is available for types that are also in the
--   <a>HasDimension</a> typeclass.
dynamicDimension :: (HasDynamicDimension a, HasDimension a) => a -> DynamicDimension

-- | The dimension of a dynamic value, which may not have any dimension at
--   all.
data DynamicDimension

-- | The value has no valid dimension.
NoDimension :: DynamicDimension

-- | The value has the given dimension.
SomeDimension :: Dimension' -> DynamicDimension

-- | The value may be interpreted as having any dimension.
AnyDimension :: DynamicDimension

-- | 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
--   <a>Dimension</a> data kind.
data Dimension'
Dim' :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> Dimension'

-- | Combines two <a>DynamicDimension</a>s, determining the
--   <a>DynamicDimension</a> of a quantity that must match both inputs.
--   
--   This is the lattice meet operation for <a>DynamicDimension</a>.
matchDimensions :: DynamicDimension -> DynamicDimension -> DynamicDimension

-- | Determines if a value that has a <a>DynamicDimension</a> is compatible
--   with a specified <a>Dimension'</a>.
isCompatibleWith :: HasDynamicDimension a => a -> Dimension' -> Bool

-- | Determines if a value that has a <a>DynamicDimension</a> in fact has
--   any valid dimension at all.
hasSomeDimension :: HasDynamicDimension a => a -> Bool

-- | The dimension of dimensionless values.
dOne :: Dimension'

-- | 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.
asList :: Dimension' -> [Int]

module Numeric.Units.Dimensional.UnitNames.InterchangeNames

-- | Represents the authority which issued an interchange name for a unit.
data InterchangeNameAuthority

-- | The interchange name originated with the Unified Code for Units of
--   Measure.
UCUM :: InterchangeNameAuthority

-- | The interchange name originated with the dimensional library.
DimensionalLibrary :: InterchangeNameAuthority

-- | The interchange name originated with a user of the dimensional
--   library.
Custom :: InterchangeNameAuthority
data InterchangeName
InterchangeName :: String -> InterchangeNameAuthority -> Bool -> InterchangeName
[name] :: InterchangeName -> String
[authority] :: InterchangeName -> InterchangeNameAuthority
[isAtomic] :: InterchangeName -> Bool

-- | Determines the authority which issued the interchange name of a unit
--   or unit name. For composite units, this is the least-authoritative
--   interchange name of any constituent name.
--   
--   Note that the least-authoritative authority is the one sorted as
--   greatest by the <a>Ord</a> instance of
--   <a>InterchangeNameAuthority</a>.
class HasInterchangeName a
interchangeName :: HasInterchangeName a => a -> InterchangeName
instance GHC.Generics.Generic Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance Data.Data.Data Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance GHC.Classes.Ord Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance GHC.Classes.Eq Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance GHC.Generics.Generic Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeNameAuthority
instance Data.Data.Data Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeNameAuthority
instance GHC.Show.Show Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeNameAuthority
instance GHC.Classes.Ord Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeNameAuthority
instance GHC.Classes.Eq Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeNameAuthority
instance Numeric.Units.Dimensional.UnitNames.InterchangeNames.HasInterchangeName Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance Control.DeepSeq.NFData Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance GHC.Show.Show Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeName
instance Control.DeepSeq.NFData Numeric.Units.Dimensional.UnitNames.InterchangeNames.InterchangeNameAuthority


-- | Provides a type level representation of <a>Variant</a>s of dimensional
--   values, which may be quantities or units.
module Numeric.Units.Dimensional.Variants

-- | The kind of variants of dimensional values.
data Variant

-- | The value is a quantity, stored as an <tt>ExactPi</tt> multiple of its
--   value in its dimension's SI coherent unit.
DQuantity :: ExactPi' -> Variant

-- | The value is a unit, possibly a <a>Metric</a> unit.
DUnit :: Metricality -> Variant

-- | Encodes whether a unit is a metric unit, that is, whether it can be
--   combined with a metric prefix to form a related unit.
data Metricality

-- | Capable of receiving a metric prefix.
Metric :: Metricality

-- | Incapable of receiving a metric prefix.
NonMetric :: Metricality

-- | Forms the product of two <a>Variant</a>s.
--   
--   The product of units is a non-metric unit.
--   
--   The product of quantities is a quantity.
type family (v1 :: Variant) * (v2 :: Variant) :: Variant
infixl 7 *
type family (v1 :: Variant) / (v2 :: Variant) :: Variant

-- | Weakens a <a>Variant</a> by forgetting possibly uninteresting
--   type-level information.
type family Weaken (v :: Variant) :: Variant

-- | Two <a>Variant</a>s are compatible when dimensional values of the
--   first may be converted into the second merely by changing the
--   representation of their values.
type CompatibleVariants v1 v2 = ('True ~ AreCompatible v1 v2)
instance GHC.Generics.Generic Numeric.Units.Dimensional.Variants.Variant
instance GHC.Generics.Generic Numeric.Units.Dimensional.Variants.Metricality
instance Data.Data.Data Numeric.Units.Dimensional.Variants.Metricality
instance GHC.Classes.Ord Numeric.Units.Dimensional.Variants.Metricality
instance GHC.Classes.Eq Numeric.Units.Dimensional.Variants.Metricality
instance Control.DeepSeq.NFData Numeric.Units.Dimensional.Variants.Metricality


-- | This module provides types and functions for manipulating unit names.
--   
--   Please note that the details of the name representation may be less
--   stable than the other APIs provided by this package, as new features
--   using them are still being developed.
module Numeric.Units.Dimensional.UnitNames

-- | The name of a unit.
data UnitName (m :: Metricality)

-- | Represents the name of an atomic unit or prefix.
data NameAtom (m :: NameAtomType)
data Prefix

-- | The name of a metric prefix.
type PrefixName = NameAtom 'PrefixAtom

-- | Encodes whether a unit is a metric unit, that is, whether it can be
--   combined with a metric prefix to form a related unit.
data Metricality

-- | Capable of receiving a metric prefix.
Metric :: Metricality

-- | Incapable of receiving a metric prefix.
NonMetric :: Metricality

-- | Constructs an atomic name for a custom unit.
atom :: String -> String -> String -> UnitName 'NonMetric

-- | Forms a <a>UnitName</a> from a <a>Metric</a> name by applying a metric
--   prefix.
applyPrefix :: Prefix -> UnitName 'Metric -> UnitName 'NonMetric

-- | Form a <a>UnitName</a> by taking the product of two others.
(*) :: UnitName m1 -> UnitName m2 -> UnitName 'NonMetric
infixl 7 *

-- | Form a <a>UnitName</a> by dividing one by another.
(/) :: UnitName m1 -> UnitName m2 -> UnitName 'NonMetric
infixl 7 /

-- | Form a <a>UnitName</a> by raising a name to an integer power.
(^) :: UnitName m -> Int -> UnitName 'NonMetric
infixr 8 ^

-- | Forms the product of a list of <a>UnitName</a>s.
--   
--   If you wish to form a heterogenous product of <a>Metric</a> and
--   <a>NonMetric</a> units you should apply <a>weaken</a> to the
--   <a>Metric</a> ones.
product :: Foldable f => f (UnitName 'NonMetric) -> UnitName 'NonMetric
reduce :: UnitName m -> UnitName m

-- | Constructs a <a>UnitName</a> by applying a grouping operation to
--   another <a>UnitName</a>, which may be useful to express precedence.
grouped :: UnitName m -> UnitName 'NonMetric

-- | The name of the base unit associated with a specified dimension.
baseUnitName :: Dimension' -> UnitName 'NonMetric

-- | A list of all <a>Prefix</a>es defined by the SI.
siPrefixes :: [Prefix]

-- | The name of the unit of dimensionless values.
nOne :: UnitName 'NonMetric

-- | The name of a metric prefix.
prefixName :: Prefix -> PrefixName

-- | The scale factor denoted by a metric prefix.
scaleFactor :: Prefix -> Rational

-- | The type of a unit name transformation that may be associated with an
--   operation that takes a single unit as input.
type UnitNameTransformer = (forall m. UnitName m -> UnitName 'NonMetric)

-- | The type of a unit name transformation that may be associated with an
--   operation that takes two units as input.
type UnitNameTransformer2 = (forall m1 m2. UnitName m1 -> UnitName m2 -> UnitName 'NonMetric)

-- | Convert a <a>UnitName</a> which may or may not be <a>Metric</a> to one
--   which is certainly <a>NonMetric</a>.
weaken :: UnitName m -> UnitName 'NonMetric

-- | Attempt to convert a <a>UnitName</a> which may or may not be
--   <a>Metric</a> to one which is certainly <a>Metric</a>.
strengthen :: UnitName m -> Maybe (UnitName 'Metric)

-- | Convert a <a>UnitName</a> of one <a>Metricality</a> into a name of
--   another metricality by strengthening or weakening if neccessary.
--   Because it may not be possible to strengthen, the result is returned
--   in a <a>Maybe</a> wrapper.
relax :: forall m1 m2. (Typeable m1, Typeable m2) => UnitName m1 -> Maybe (UnitName m2)

-- | The full name of the unit in international English
name_en :: NameAtom m -> String

-- | The abbreviated name of the unit in international English
abbreviation_en :: NameAtom m -> String
asAtomic :: UnitName m -> Maybe (NameAtom ('UnitAtom m))


-- | Re-exports the raw <a>Quantity</a> constructor from the
--   Numeric.Units.Dimensional.Internal module, along with <a>coerce</a>,
--   for convenience in converting between raw representations and
--   dimensional values.
--   
--   Note that use of these constructs requires the user to verify the
--   dimensional safety of the conversion, because the coercion doesn't
--   explicitly mention the unit of the representation. Note also that the
--   <a>Quantity</a> constructor constructs a <a>SQuantity</a> which may
--   have a scale factor other than <a>One</a>.
--   
--   Note that the haddock documentation doesn't mention the
--   <a>Quantity</a> constructor because it is a part of the
--   <a>Dimensional</a> associated data family, but it is exported by this
--   module.
module Numeric.Units.Dimensional.Coercion
coerce :: Coercible a b => a -> b

-- | A dimensional value, either a <a>Quantity</a> or a <a>Unit</a>,
--   parameterized by its <a>Dimension</a> and representation.
data family Dimensional v :: Dimension -> Type -> Type

-- | Unwraps a possibly-scaled <a>SQuantity</a>, yielding its underlying
--   representation.
--   
--   This is a type-restricted version of <a>coerce</a>.
unQuantity :: SQuantity s d a -> a


-- | <h1>Summary</h1>
--   
--   In this module we provide data types for performing arithmetic with
--   physical quantities and units. Information about the physical
--   dimensions of the quantities/units is embedded in their types and the
--   validity of operations is verified by the type checker at compile
--   time. The boxing and unboxing of numerical values as quantities is
--   done by multiplication and division of units, of which an incomplete
--   set is provided.
--   
--   We limit ourselves to "Newtonian" physics. We do not attempt to
--   accommodate relativistic physics in which e.g. addition of length and
--   time would be valid.
--   
--   As far as possible and/or practical the conventions and guidelines of
--   NIST's "Guide for the Use of the International System of Units (SI)"
--   <a>[1]</a> are followed. Occasionally we will reference specific
--   sections from the guide and deviations will be explained.
--   
--   <h2>Disclaimer</h2>
--   
--   Merely an engineer, the author doubtlessly uses a language and
--   notation that makes mathematicians and physicist cringe. He does not
--   mind constructive criticism (or pull requests).
--   
--   The sets of functions and units defined herein are incomplete and
--   reflect only the author's needs to date. Again, patches are welcome.
--   
--   <h1>Usage</h1>
--   
--   <h2>Preliminaries</h2>
--   
--   This module requires GHC 8 or later. We utilize Data Kinds, TypeNats,
--   Closed Type Families, etc. Clients of the module are generally not
--   required to use these extensions.
--   
--   Clients probably will want to use the NegativeLiterals extension.
--   
--   <h2>Examples</h2>
--   
--   We have defined operators and units that allow us to define and work
--   with physical quantities. A physical quantity is defined by
--   multiplying a number with a unit (the type signature is optional).
--   
--   <pre>
--   v :: Velocity Prelude.Double
--   v = 90 *~ (kilo meter / hour)
--   </pre>
--   
--   It follows naturally that the numerical value of a quantity is
--   obtained by division by a unit.
--   
--   <pre>
--   numval :: Prelude.Double
--   numval = v /~ (meter / second)
--   </pre>
--   
--   The notion of a quantity as the product of a numerical value and a
--   unit is supported by 7.1 "Value and numerical value of a quantity" of
--   <a>[1]</a>. While the above syntax is fairly natural it is unfortunate
--   that it must violate a number of the guidelines in <a>[1]</a>, in
--   particular 9.3 "Spelling unit names with prefixes", 9.4 "Spelling unit
--   names obtained by multiplication", 9.5 "Spelling unit names obtained
--   by division".
--   
--   As a more elaborate example of how to use the module we define a
--   function for calculating the escape velocity of a celestial body
--   <a>[2]</a>.
--   
--   <pre>
--   escapeVelocity :: (Floating a) =&gt; Mass a -&gt; Length a -&gt; Velocity a
--   escapeVelocity m r = sqrt (two * g * m / r)
--     where
--         two = 2 *~ one
--         g = 6.6720e-11 *~ (newton * meter ^ pos2 / kilo gram ^ pos2)
--   </pre>
--   
--   For completeness we should also show an example of the error messages
--   we will get from GHC when performing invalid arithmetic. In the best
--   case GHC will be able to use the type synonyms we have defined in its
--   error messages.
--   
--   <pre>
--   let x = 1 *~ meter + 1 *~ second
--   
--   Couldn't match type 'Numeric.NumType.DK.Integers.Zero
--                  with 'Numeric.NumType.DK.Integers.Pos1
--   Expected type: Unit 'Metric DLength a
--     Actual type: Unit 'Metric DTime a
--   In the second argument of `(*~)', namely `second'
--   In the second argument of `(+)', namely `1 *~ second'
--   </pre>
--   
--   In other cases the error messages aren't very friendly.
--   
--   <pre>
--   let x = 1 *~ meter / (1 *~ second) + 1 *~ kilo gram
--   
--   Couldn't match type 'Numeric.NumType.DK.Integers.Zero
--                  with 'Numeric.NumType.DK.Integers.Neg1
--   Expected type: Quantity DMass a
--     Actual type: Dimensional
--                    ('DQuantity V.* 'DQuantity) (DLength / DTime) a
--   In the first argument of `(+)', namely `1 *~ meter / (1 *~ second)'
--   In the expression: 1 *~ meter / (1 *~ second) + 1 *~ kilo gram
--   In an equation for `x':
--         x = 1 *~ meter / (1 *~ second) + 1 *~ kilo gram
--   </pre>
--   
--   It is the author's experience that the usefulness of the compiler
--   error messages is more often than not limited to pinpointing the
--   location of errors.
--   
--   <h1>Notes</h1>
--   
--   <h2>Future work</h2>
--   
--   While there is an insane amount of units in use around the world it is
--   reasonable to provide those in relatively widespread use. Units
--   outside of SI will most likely be added on an as-needed basis.
--   
--   Additional physics models could be implemented. See <a>[3]</a> for
--   ideas.
--   
--   <h2>Related work</h2>
--   
--   Henning Thielemann numeric prelude has a physical units library,
--   however, checking of dimensions is dynamic rather than static. Aaron
--   Denney has created a toy example of statically checked physical
--   dimensions covering only length and time. HaskellWiki has pointers
--   <a>[4]</a> to these.
--   
--   Also see Samuel Hoffstaetter's blog post <a>[5]</a> which uses
--   techniques similar to this library.
--   
--   Libraries with similar functionality exist for other programming
--   languages and may serve as inspiration. The author has found the Java
--   library JScience <a>[6]</a> and the Fortress programming language
--   <a>[7]</a> particularly noteworthy.
--   
--   <h2>References</h2>
--   
--   <ol>
--   <li><a>http://physics.nist.gov/Pubs/SP811/</a></li>
--   <li><a>http://en.wikipedia.org/wiki/Escape_velocity</a></li>
--   
--   <li><a>http://jscience.org/api/org/jscience/physics/models/package-summary.html</a></li>
--   <li><a>http://www.haskell.org/haskellwiki/Physical_units</a></li>
--   
--   <li><a>http://liftm.wordpress.com/2007/06/03/scientificdimension-type-arithmetic-and-physical-units-in-haskell/</a></li>
--   <li><a>http://jscience.org/</a></li>
--   <li><a>http://research.sun.com/projects/plrg/fortress.pdf</a></li>
--   </ol>
module Numeric.Units.Dimensional

-- | A dimensional value, either a <a>Quantity</a> or a <a>Unit</a>,
--   parameterized by its <a>Dimension</a> and representation.
data family Dimensional v :: Dimension -> Type -> Type

-- | A unit of measurement.
type Unit (m :: Metricality) = Dimensional ('DUnit m)

-- | A dimensional quantity.
type Quantity = SQuantity One

-- | Encodes whether a unit is a metric unit, that is, whether it can be
--   combined with a metric prefix to form a related unit.
data Metricality

-- | Capable of receiving a metric prefix.
Metric :: Metricality

-- | Incapable of receiving a metric prefix.
NonMetric :: Metricality

-- | 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:
--   
--   <ul>
--   <li>l: Length</li>
--   <li>m: Mass</li>
--   <li>t: Time</li>
--   <li>i: Electric current</li>
--   <li>th: Thermodynamic temperature</li>
--   <li>n: Amount of substance</li>
--   <li>j: Luminous intensity</li>
--   </ul>
--   
--   For the equivalent term-level representation, see <a>Dimension'</a>
data Dimension
Dim :: TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> Dimension

-- | Multiplication of dimensions corresponds to adding of the base
--   dimensions' exponents.
type family (a :: Dimension) * (b :: Dimension)
infixl 7 *

-- | Division of dimensions corresponds to subtraction of the base
--   dimensions' exponents.
type family (a :: Dimension) / (d :: Dimension)
infixl 7 /

-- | Powers of dimensions corresponds 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.
type family (d :: Dimension) ^ (x :: TypeInt)
infixr 8 ^

-- | Roots of dimensions corresponds to division of the base dimensions'
--   exponents by the order of the root.
type family NRoot (d :: Dimension) (x :: TypeInt)

-- | Square root is a special case of <a>NRoot</a> with order 2.
type Sqrt d = NRoot d 'Pos2

-- | Cube root is a special case of <a>NRoot</a> with order 3.
type Cbrt d = NRoot d 'Pos3

-- | The reciprocal of a dimension is defined as the result of dividing
--   <a>DOne</a> by it, or of negating each of the base dimensions'
--   exponents.
type Recip (d :: Dimension) = DOne / d

-- | 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
--   <a>Dimension</a> data kind.
data Dimension'
Dim' :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> Dimension'

-- | Dimensional values inhabit this class, which allows access to a
--   term-level representation of their dimension.
class HasDynamicDimension a => HasDimension a

-- | Obtains a term-level representation of a value's dimension.
dimension :: HasDimension a => a -> Dimension'

-- | A KnownDimension is one for which we can construct a term-level
--   representation. Each validly constructed type of kind <a>Dimension</a>
--   has a <a>KnownDimension</a> instance.
--   
--   While <a>KnownDimension</a> is a constraint synonym, the presence of
--   <tt><a>KnownDimension</a> d</tt> in a context allows use of
--   <tt><a>dimension</a> :: <a>Proxy</a> d -&gt; <a>Dimension'</a></tt>.
type KnownDimension (d :: Dimension) = HasDimension (Proxy d)

-- | Forms a <a>Quantity</a> by multipliying a number and a unit.
(*~) :: Num a => a -> Unit m d a -> Quantity d a
infixl 7 *~

-- | Divides a <a>Quantity</a> by a <a>Unit</a> of the same physical
--   dimension, obtaining the numerical value of the quantity expressed in
--   that unit.
(/~) :: Fractional a => Quantity d a -> Unit m d a -> a
infixl 7 /~

-- | Raises a <a>Quantity</a> or <a>Unit</a> to an integer power.
--   
--   Because the power chosen impacts the <a>Dimension</a> of the result,
--   it is necessary to supply a type-level representation of the exponent
--   in the form of a <a>Proxy</a> to some <tt>TypeInt</tt>. Convenience
--   values <tt>pos1</tt>, <a>pos2</a>, <tt>neg1</tt>, ... are supplied by
--   the <a>Numeric.NumType.DK.Integers</a> module. The most commonly used
--   ones are also reexported by <a>Numeric.Units.Dimensional.Prelude</a>.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <tt>NotPrefixable</tt>.
(^) :: (Fractional a, KnownTypeInt i, KnownVariant v, KnownVariant (Weaken v)) => Dimensional v d1 a -> Proxy i -> Dimensional (Weaken v) (d1 ^ i) a
infixr 8 ^

-- | Computes the nth root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application of this operator
--   where the result would have a fractional dimension or where n is zero.
--   
--   Because the root chosen impacts the <a>Dimension</a> of the result, it
--   is necessary to supply a type-level representation of the root in the
--   form of a <a>Proxy</a> to some <tt>TypeInt</tt>. Convenience values
--   <tt>pos1</tt>, <a>pos2</a>, <tt>neg1</tt>, ... are supplied by the
--   <a>Numeric.NumType.DK.Integers</a> module. The most commonly used ones
--   are also reexported by <a>Numeric.Units.Dimensional.Prelude</a>.
--   
--   Also available in prefix form, see <a>nroot</a>.
(^/) :: (KnownTypeInt n, Floating a) => Quantity d a -> Proxy n -> Quantity (NRoot d n) a
infixr 8 ^/

-- | Raises a dimensionless quantity to a dimensionless power.
(**) :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a
infixr 8 **

-- | Multiplies two <a>Quantity</a>s or two <a>Unit</a>s.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <a>NonMetric</a>.
(*) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 * v2), Num a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 * v2) (d1 * d2) a
infixl 7 *

-- | Divides one <a>Quantity</a> by another or one <a>Unit</a> by another.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <tt>NotPrefixable</tt>.
(/) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 / v2), Fractional a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 / v2) (d1 / d2) a
infixl 7 /

-- | Adds two <a>Quantity</a>s.
(+) :: Num a => Quantity d a -> Quantity d a -> Quantity d a
infixl 6 +

-- | Subtracts one <a>Quantity</a> from another.
(-) :: Num a => Quantity d a -> Quantity d a -> Quantity d a
infixl 6 -

-- | Negates the value of a <a>Quantity</a>.
negate :: Num a => Quantity d a -> Quantity d a

-- | Takes the absolute value of a <a>Quantity</a>.
abs :: Num a => Quantity d a -> Quantity d a

-- | Takes the sign of a <a>Quantity</a>. The functions <a>abs</a> and
--   <a>signum</a> satisy the law that:
--   
--   <pre>
--   abs x * signum x == x
--   </pre>
--   
--   The sign is either <tt>negate _1</tt> (negative), <tt>_0</tt> (zero),
--   or <tt>_1</tt> (positive).
signum :: Num a => Quantity d a -> Dimensionless a

-- | Forms the reciprocal of a <a>Quantity</a>, which has the reciprocal
--   dimension.
--   
--   <pre>
--   &gt;&gt;&gt; recip $ 47 *~ hertz
--   2.127659574468085e-2 s
--   </pre>
recip :: Fractional a => Quantity d a -> Quantity (Recip d) a

-- | Computes the nth root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application of this operator
--   where the result would have a fractional dimension or where n is zero.
--   
--   Because the root chosen impacts the <a>Dimension</a> of the result, it
--   is necessary to supply a type-level representation of the root in the
--   form of a <a>Proxy</a> to some <tt>TypeInt</tt>. Convenience values
--   <tt>pos1</tt>, <a>pos2</a>, <tt>neg1</tt>, ... are supplied by the
--   <a>Numeric.NumType.DK.Integers</a> module. The most commonly used ones
--   are also reexported by <a>Numeric.Units.Dimensional.Prelude</a>.
--   
--   n must not be zero. Negative roots are defined such that <tt>nroot
--   (Proxy :: Proxy (Negate n)) x == nroot (Proxy :: Proxy n) (recip
--   x)</tt>.
--   
--   Also available in operator form, see <a>^/</a>.
nroot :: (KnownTypeInt n, Floating a) => Proxy n -> Quantity d a -> Quantity (NRoot d n) a

-- | Computes the square root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application where the
--   supplied quantity does not have a square dimension.
--   
--   <pre>
--   (x :: Area Double) &gt;= _0 ==&gt; sqrt x == nroot pos2 x
--   </pre>
sqrt :: Floating a => Quantity d a -> Quantity (Sqrt d) a

-- | Computes the cube root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application where the
--   supplied quantity does not have a cubic dimension.
--   
--   <pre>
--   (x :: Volume Double) &gt;= _0 ==&gt; cbrt x == nroot pos3 x
--   </pre>
cbrt :: Floating a => Quantity d a -> Quantity (Cbrt d) a
exp :: Floating a => Dimensionless a -> Dimensionless a
log :: Floating a => Dimensionless a -> Dimensionless a

-- | Takes the logarithm of the second argument in the base of the first.
--   
--   <pre>
--   &gt;&gt;&gt; logBase _2 _8
--   3.0
--   </pre>
logBase :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a
sin :: Floating a => Dimensionless a -> Dimensionless a
cos :: Floating a => Dimensionless a -> Dimensionless a
tan :: Floating a => Dimensionless a -> Dimensionless a
asin :: Floating a => Dimensionless a -> Dimensionless a
acos :: Floating a => Dimensionless a -> Dimensionless a
atan :: Floating a => Dimensionless a -> Dimensionless a
sinh :: Floating a => Dimensionless a -> Dimensionless a
cosh :: Floating a => Dimensionless a -> Dimensionless a
tanh :: Floating a => Dimensionless a -> Dimensionless a
asinh :: Floating a => Dimensionless a -> Dimensionless a
acosh :: Floating a => Dimensionless a -> Dimensionless a
atanh :: Floating a => Dimensionless a -> Dimensionless a

-- | The standard two argument arctangent function. Since it interprets its
--   two arguments in comparison with one another, the input may have any
--   dimension.
--   
--   <pre>
--   &gt;&gt;&gt; atan2 _0 _1
--   0.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; atan2 _1 _0
--   1.5707963267948966
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; atan2 _0 (negate _1)
--   3.141592653589793
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; atan2 (negate _1) _0
--   -1.5707963267948966
--   </pre>
atan2 :: RealFloat a => Quantity d a -> Quantity d a -> Dimensionless a
log1p :: Floating a => Dimensionless a -> Dimensionless a
expm1 :: Floating a => Dimensionless a -> Dimensionless a
log1pexp :: Floating a => Dimensionless a -> Dimensionless a
log1mexp :: Floating a => Dimensionless a -> Dimensionless a

-- | Applies <a>*~</a> to all values in a functor.
(*~~) :: (Functor f, Num a) => f a -> Unit m d a -> f (Quantity d a)
infixl 7 *~~

-- | Applies <a>/~</a> to all values in a functor.
(/~~) :: forall f m d a. (Functor f, Fractional a) => f (Quantity d a) -> Unit m d a -> f a
infixl 7 /~~

-- | The sum of all elements in a foldable structure.
--   
--   <pre>
--   &gt;&gt;&gt; sum ([] :: [Mass Double])
--   0.0 kg
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; sum [12.4 *~ meter, 1 *~ foot]
--   12.7048 m
--   </pre>
sum :: (Num a, Foldable f) => f (Quantity d a) -> Quantity d a

-- | The arithmetic mean of all elements in a foldable structure.
--   
--   <pre>
--   &gt;&gt;&gt; mean [pi, _7]
--   5.070796326794897
--   </pre>
mean :: (Fractional a, Foldable f) => f (Quantity d a) -> Quantity d a

-- | The product of all elements in a foldable structure.
--   
--   <pre>
--   &gt;&gt;&gt; product ([] :: [Dimensionless Double])
--   1.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; product [pi, _4, 0.36 *~ one]
--   4.523893421169302
--   </pre>
product :: (Num a, Foldable f) => f (Dimensionless a) -> Dimensionless a

-- | The length of the foldable data structure as a <a>Dimensionless</a>.
--   This can be useful for purposes of e.g. calculating averages.
--   
--   <pre>
--   &gt;&gt;&gt; dimensionlessLength ["foo", "bar"]
--   2
--   </pre>
dimensionlessLength :: (Num a, Foldable f) => f b -> Dimensionless a

-- | Returns a list of quantities between given bounds.
--   
--   <pre>
--   n &lt;= 0 ==&gt; nFromTo (x :: Mass Double) (y :: Mass Double) n == [x, y]
--   </pre>
--   
--   <pre>
--   (x :: Length Double) &lt;= (y :: Length Double) ==&gt; all (\z -&gt; x &lt;= z &amp;&amp; z &lt;= y) (nFromTo x y n)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nFromTo _0 _3 2
--   [0.0,1.0,2.0,3.0]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nFromTo _1 _0 7
--   [1.0,0.875,0.75,0.625,0.5,0.375,0.25,0.125,0.0]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nFromTo _0 _1 (-5)
--   [0.0,1.0]
--   </pre>
nFromTo :: (Fractional a, Integral b) => Quantity d a -> Quantity d a -> b -> [Quantity d a]

-- | The type-level dimension of dimensionless values.
type DOne = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DLength = 'Dim 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DMass = 'Dim 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DTime = 'Dim 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero
type DElectricCurrent = 'Dim 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
type DThermodynamicTemperature = 'Dim 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero
type DAmountOfSubstance = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero
type DLuminousIntensity = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1
type Dimensionless = Quantity DOne
type Length = Quantity DLength
type Mass = Quantity DMass
type Time = Quantity DTime
type ElectricCurrent = Quantity DElectricCurrent
type ThermodynamicTemperature = Quantity DThermodynamicTemperature
type AmountOfSubstance = Quantity DAmountOfSubstance
type LuminousIntensity = Quantity DLuminousIntensity

-- | The constant for zero is polymorphic, allowing it to express zero
--   <a>Length</a> or <a>Capacitance</a> or <a>Velocity</a> etc, in
--   addition to the <a>Dimensionless</a> value zero.
_0 :: Num a => Quantity d a
_1 :: Num a => Dimensionless a
_2 :: Num a => Dimensionless a
_3 :: Num a => Dimensionless a
_4 :: Num a => Dimensionless a
_5 :: Num a => Dimensionless a
_6 :: Num a => Dimensionless a
_7 :: Num a => Dimensionless a
_8 :: Num a => Dimensionless a
_9 :: Num a => Dimensionless a
pi :: Floating a => Dimensionless a

-- | Twice <a>pi</a>.
--   
--   For background on <a>tau</a> see
--   <a>http://tauday.com/tau-manifesto</a> (but also feel free to review
--   <a>http://www.thepimanifesto.com)</a>.
tau :: Floating a => Dimensionless a

-- | A polymorphic <a>Unit</a> which can be used in place of the coherent
--   SI base unit of any dimension. This allows polymorphic quantity
--   creation and destruction without exposing the <a>Dimensional</a>
--   constructor.
siUnit :: forall d a. (KnownDimension d, Num a) => Unit 'NonMetric d a

-- | The unit <a>one</a> has dimension <a>DOne</a> and is the base unit of
--   dimensionless values.
--   
--   As detailed in 7.10 "Values of quantities expressed simply as numbers:
--   the unit one, symbol 1" of <a>[1]</a> the unit one generally does not
--   appear in expressions. However, for us it is necessary to use
--   <a>one</a> as we would any other unit to perform the "boxing" of
--   dimensionless values.
one :: Num a => Unit 'NonMetric DOne a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is
--   irrational or <a>Approximate</a>. See <a>mkUnitQ</a> for when it is
--   rational and <a>mkUnitZ</a> for when it is an integer.
--   
--   Note that supplying zero as a definining quantity is invalid, as the
--   library relies upon units forming a group under multiplication.
--   
--   Supplying negative defining quantities is allowed and handled
--   gracefully, but is discouraged on the grounds that it may be
--   unexpected by other readers.
mkUnitR :: Floating a => UnitName m -> ExactPi -> Unit m1 d a -> Unit m d a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is
--   rational. See <a>mkUnitZ</a> for when it is an integer and
--   <a>mkUnitR</a> for the general case.
--   
--   For more information see <a>mkUnitR</a>.
mkUnitQ :: Fractional a => UnitName m -> Rational -> Unit m1 d a -> Unit m d a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is an
--   integer. See <a>mkUnitQ</a> for when it is rational and <a>mkUnitR</a>
--   for the general case.
--   
--   For more information see <a>mkUnitR</a>.
mkUnitZ :: Num a => UnitName m -> Integer -> Unit m1 d a -> Unit m d a

-- | Extracts the <a>UnitName</a> of a <a>Unit</a>.
name :: Unit m d a -> UnitName m

-- | Extracts the exact value of a <a>Unit</a>, expressed in terms of the
--   SI coherent derived unit (see <a>siUnit</a>) of the same
--   <a>Dimension</a>.
--   
--   Note that the actual value may in some cases be approximate, for
--   example if the unit is defined by experiment.
exactValue :: Unit m d a -> ExactPi

-- | Discards potentially unwanted type level information about a
--   <a>Unit</a>.
weaken :: Unit m d a -> Unit 'NonMetric d a

-- | Attempts to convert a <a>Unit</a> which may or may not be
--   <a>Metric</a> to one which is certainly <a>Metric</a>.
strengthen :: Unit m d a -> Maybe (Unit 'Metric d a)

-- | Forms the exact version of a <a>Unit</a>.
exactify :: Unit m d a -> Unit m d ExactPi

-- | Shows the value of a <a>Quantity</a> expressed in a specified
--   <a>Unit</a> of the same <a>Dimension</a>.
--   
--   Uses non-breaking spaces between the value and the unit, and within
--   the unit name.
--   
--   <pre>
--   &gt;&gt;&gt; putStrLn $ showIn watt $ (37 *~ volt) * (4 *~ ampere)
--   148.0 W
--   </pre>
showIn :: (Show a, Fractional a) => Unit m d a -> Quantity d a -> String

-- | A KnownVariant is one whose term-level <a>Dimensional</a> values we
--   can represent with an associated data family instance and manipulate
--   with certain functions, not all of which are exported from the
--   package.
--   
--   Each validly constructed type of kind <a>Variant</a> has a
--   <a>KnownVariant</a> instance.
class KnownVariant (v :: Variant)

-- | Maps over the underlying representation of a dimensional value. The
--   caller is responsible for ensuring that the supplied function respects
--   the dimensional abstraction. This means that the function must
--   preserve numerical values, or linearly scale them while preserving the
--   origin.
dmap :: KnownVariant v => (a1 -> a2) -> Dimensional v d a1 -> Dimensional v d a2

-- | Convenient conversion between numerical types while retaining
--   dimensional information.
--   
--   <pre>
--   &gt;&gt;&gt; let x = (37 :: Rational) *~ poundMass
--   
--   &gt;&gt;&gt; changeRep x :: Mass Double
--   16.78291769 kg
--   </pre>
changeRep :: (KnownVariant v, Real a, Fractional b) => Dimensional v d a -> Dimensional v d b

-- | Convenient conversion from exactly represented values while retaining
--   dimensional information.
changeRepApproximate :: (KnownVariant v, Floating b) => Dimensional v d ExactPi -> Dimensional v d b

-- | Converts a <a>Unit</a> into a lens from <a>Quantity</a>s to values.
asLens :: Fractional a => Unit m d a -> forall f. Functor f => (a -> f a) -> Quantity d a -> f (Quantity d a)


-- | <h1>Summary</h1>
--   
--   This module defines type synonyms for common dimensionalities and the
--   associated quantity types. Additional dimensionalities and quantity
--   types will be added on an as-needed basis.
--   
--   The definitions in this module are grouped so that a type synonym for
--   the dimensionality is defined first in terms of base dimension
--   exponents. Then a type synonym for the corresponding quantity type is
--   defined. If there are several quantity types with the same
--   dimensionality type synonyms are provided for each quantity type.
--   
--   <h1>References</h1>
--   
--   <ol>
--   <li><a>http://physics.nist.gov/Pubs/SP811/</a></li>
--   </ol>
module Numeric.Units.Dimensional.Quantities
type Area = Quantity DArea
type Volume = Quantity DVolume
type Velocity = Quantity DVelocity
type Acceleration = Quantity DAcceleration
type WaveNumber = Quantity DWaveNumber
type MassDensity = Quantity DMassDensity
type Density = MassDensity
type SpecificVolume = Quantity DSpecificVolume
type CurrentDensity = Quantity DCurrentDensity
type MagneticFieldStrength = Quantity DMagneticFieldStrength
type AmountOfSubstanceConcentration = Quantity DAmountOfSubstanceConcentration
type Concentration = AmountOfSubstanceConcentration
type Luminance = Quantity DLuminance
type PlaneAngle = Dimensionless
type SolidAngle = Dimensionless
type Frequency = Quantity DFrequency
type Force = Quantity DForce
type Pressure = Quantity DPressure
type Stress = Quantity DStress
type Energy = Quantity DEnergy
type Work = Quantity DWork
type QuantityOfHeat = Quantity DQuantityOfHeat
type Power = Quantity DPower
type RadiantFlux = Quantity DRadiantFlux
type ElectricCharge = Quantity DElectricCharge
type QuantityOfElectricity = Quantity DQuantityOfElectricity
type ElectricPotential = Quantity DElectricPotential
type PotentialDifference = Quantity DPotentialDifference
type ElectromotiveForce = Quantity DElectromotiveForce
type Capacitance = Quantity DCapacitance
type ElectricResistance = Quantity DElectricResistance
type ElectricConductance = Quantity DElectricConductance
type MagneticFlux = Quantity DMagneticFlux
type MagneticFluxDensity = Quantity DMagneticFluxDensity
type Inductance = Quantity DInductance
type LuminousFlux = Quantity DLuminousFlux
type Illuminance = Quantity DIlluminance
type CelsiusTemperature = Quantity DCelsiusTemperature
type Activity = Quantity DActivity
type AbsorbedDose = Quantity DAbsorbedDose
type SpecificEnergy = Quantity DSpecificEnergy
type Kerma = Quantity DKerma
type DoseEquivalent = Quantity DDoseEquivalent
type AmbientDoseEquivalent = DoseEquivalent
type DirectionalDoseEquivalent = DoseEquivalent
type PersonalDoseEquivalent = DoseEquivalent
type EquivalentDose = DoseEquivalent
type CatalyticActivity = Quantity DCatalyticActivity
type AngularVelocity = Quantity DAngularVelocity
type AngularAcceleration = Quantity DAngularAcceleration
type DynamicViscosity = Quantity DDynamicViscosity
type MomentOfForce = Quantity DMomentOfForce
type SurfaceTension = Quantity DSurfaceTension
type HeatFluxDensity = Quantity DHeatFluxDensity
type Irradiance = Quantity DIrradiance
type RadiantIntensity = Quantity DRadiantIntensity
type Radiance = Quantity DRadiance
type HeatCapacity = Quantity DHeatCapacity
type Entropy = Quantity DEntropy
type SpecificHeatCapacity = Quantity DSpecificHeatCapacity
type SpecificEntropy = Quantity DSpecificEntropy
type ThermalConductivity = Quantity DThermalConductivity
type EnergyDensity = Quantity DEnergyDensity
type ElectricFieldStrength = Quantity DElectricFieldStrength
type ElectricChargeDensity = Quantity DElectricChargeDensity
type ElectricFluxDensity = Quantity DElectricFluxDensity
type Permittivity = Quantity DPermittivity
type Permeability = Quantity DPermeability
type MolarEnergy = Quantity DMolarEnergy
type MolarEntropy = Quantity DMolarEntropy
type MolarHeatCapacity = Quantity DMolarHeatCapacity
type Exposure = Quantity DExposure
type AbsorbedDoseRate = Quantity DAbsorbedDoseRate
type Impulse = Quantity DImpulse
type Momentum = Quantity DMomentum
type MassFlow = Quantity DMassFlow
type VolumeFlow = Quantity DVolumeFlow
type GravitationalParameter = Quantity DGravitationalParameter
type KinematicViscosity = Quantity DKinematicViscosity
type FirstMassMoment = Quantity DFirstMassMoment
type MomentOfInertia = Quantity DMomentOfInertia
type AngularMomentum = Quantity DAngularMomentum
type ThermalResistivity = Quantity DThermalResistivity
type ThermalConductance = Quantity DThermalConductance
type ThermalResistance = Quantity DThermalResistance
type HeatTransferCoefficient = Quantity DHeatTransferCoefficient
type ThermalAdmittance = HeatTransferCoefficient
type ThermalInsulance = Quantity DThermalInsulance
type Jerk = Quantity DJerk
type Angle = PlaneAngle
type Thrust = Force
type Torque = MomentOfForce
type EnergyPerUnitMass = SpecificEnergy

-- | Constructs a unit of area from a unit of length, taking the area of a
--   square whose sides are that length.
--   
--   <pre>
--   &gt;&gt;&gt; 64 *~ square meter == (8 *~ meter) ^ pos2
--   True
--   </pre>
square :: (Fractional a, Typeable m) => Unit m DLength a -> Unit 'NonMetric DArea a

-- | Constructs a unit of volume from a unit of length, taking the volume
--   of a cube whose sides are that length.
--   
--   <pre>
--   &gt;&gt;&gt; 64 *~ cubic meter == (4 *~ meter) ^ pos3
--   True
--   </pre>
cubic :: (Fractional a, Typeable m) => Unit m DLength a -> Unit 'NonMetric DVolume a
type DArea = 'Dim 'Pos2 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DVolume = 'Dim 'Pos3 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DVelocity = 'Dim 'Pos1 'Zero 'Neg1 'Zero 'Zero 'Zero 'Zero
type DAcceleration = 'Dim 'Pos1 'Zero 'Neg2 'Zero 'Zero 'Zero 'Zero
type DWaveNumber = 'Dim 'Neg1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DMassDensity = 'Dim 'Neg3 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DDensity = DMassDensity
type DSpecificVolume = 'Dim 'Pos3 'Neg1 'Zero 'Zero 'Zero 'Zero 'Zero
type DCurrentDensity = 'Dim 'Neg2 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
type DMagneticFieldStrength = 'Dim 'Neg1 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
type DAmountOfSubstanceConcentration = 'Dim 'Neg3 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero
type DConcentration = DAmountOfSubstanceConcentration
type DLuminance = 'Dim 'Neg2 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1
type DPlaneAngle = DOne
type DSolidAngle = DOne
type DFrequency = 'Dim 'Zero 'Zero 'Neg1 'Zero 'Zero 'Zero 'Zero
type DForce = 'Dim 'Pos1 'Pos1 'Neg2 'Zero 'Zero 'Zero 'Zero
type DPressure = 'Dim 'Neg1 'Pos1 'Neg2 'Zero 'Zero 'Zero 'Zero
type DStress = DPressure
type DEnergy = 'Dim 'Pos2 'Pos1 'Neg2 'Zero 'Zero 'Zero 'Zero
type DWork = DEnergy
type DQuantityOfHeat = DEnergy
type DPower = 'Dim 'Pos2 'Pos1 'Neg3 'Zero 'Zero 'Zero 'Zero
type DRadiantFlux = DPower
type DElectricCharge = 'Dim 'Zero 'Zero 'Pos1 'Pos1 'Zero 'Zero 'Zero
type DQuantityOfElectricity = DElectricCharge
type DElectricPotential = 'Dim 'Pos2 'Pos1 'Neg3 'Neg1 'Zero 'Zero 'Zero
type DPotentialDifference = DElectricPotential
type DElectromotiveForce = DElectricPotential
type DCapacitance = 'Dim 'Neg2 'Neg1 'Pos4 'Pos2 'Zero 'Zero 'Zero
type DElectricResistance = 'Dim 'Pos2 'Pos1 'Neg3 'Neg2 'Zero 'Zero 'Zero
type DElectricConductance = 'Dim 'Neg2 'Neg1 'Pos3 'Pos2 'Zero 'Zero 'Zero
type DMagneticFlux = 'Dim 'Pos2 'Pos1 'Neg2 'Neg1 'Zero 'Zero 'Zero
type DMagneticFluxDensity = 'Dim 'Zero 'Pos1 'Neg2 'Neg1 'Zero 'Zero 'Zero
type DInductance = 'Dim 'Pos2 'Pos1 'Neg2 'Neg2 'Zero 'Zero 'Zero
type DLuminousFlux = DLuminousIntensity
type DIlluminance = 'Dim 'Neg2 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1
type DCelsiusTemperature = DThermodynamicTemperature
type DActivity = DFrequency
type DAbsorbedDose = 'Dim 'Pos2 'Zero 'Neg2 'Zero 'Zero 'Zero 'Zero
type DSpecificEnergy = DAbsorbedDose
type DKerma = DAbsorbedDose
type DDoseEquivalent = DAbsorbedDose
type DAmbientDoseEquivalent = DDoseEquivalent
type DDirectionalDoseEquivalent = DDoseEquivalent
type DPersonalDoseEquivalent = DDoseEquivalent
type DEquivalentDose = DDoseEquivalent
type DCatalyticActivity = 'Dim 'Zero 'Zero 'Neg1 'Zero 'Zero 'Pos1 'Zero
type DAngularVelocity = DFrequency
type DAngularAcceleration = 'Dim 'Zero 'Zero 'Neg2 'Zero 'Zero 'Zero 'Zero
type DDynamicViscosity = 'Dim 'Neg1 'Pos1 'Neg1 'Zero 'Zero 'Zero 'Zero
type DMomentOfForce = DEnergy
type DSurfaceTension = 'Dim 'Zero 'Pos1 'Neg2 'Zero 'Zero 'Zero 'Zero
type DHeatFluxDensity = 'Dim 'Zero 'Pos1 'Neg3 'Zero 'Zero 'Zero 'Zero
type DIrradiance = DHeatFluxDensity
type DRadiantIntensity = DPower
type DRadiance = DIrradiance
type DHeatCapacity = 'Dim 'Pos2 'Pos1 'Neg2 'Zero 'Neg1 'Zero 'Zero
type DEntropy = DHeatCapacity
type DSpecificHeatCapacity = 'Dim 'Pos2 'Zero 'Neg2 'Zero 'Neg1 'Zero 'Zero
type DSpecificEntropy = DSpecificHeatCapacity
type DThermalConductivity = 'Dim 'Pos1 'Pos1 'Neg3 'Zero 'Neg1 'Zero 'Zero
type DEnergyDensity = DPressure
type DElectricFieldStrength = 'Dim 'Pos1 'Pos1 'Neg3 'Neg1 'Zero 'Zero 'Zero
type DElectricChargeDensity = 'Dim 'Neg3 'Zero 'Pos1 'Pos1 'Zero 'Zero 'Zero
type DElectricFluxDensity = 'Dim 'Neg2 'Zero 'Pos1 'Pos1 'Zero 'Zero 'Zero
type DPermittivity = 'Dim 'Neg3 'Neg1 'Pos4 'Pos2 'Zero 'Zero 'Zero
type DPermeability = 'Dim 'Pos1 'Pos1 'Neg2 'Neg2 'Zero 'Zero 'Zero
type DMolarEnergy = 'Dim 'Pos2 'Pos1 'Neg2 'Zero 'Zero 'Neg1 'Zero
type DMolarEntropy = 'Dim 'Pos2 'Pos1 'Neg2 'Zero 'Neg1 'Neg1 'Zero
type DMolarHeatCapacity = DMolarEntropy
type DExposure = 'Dim 'Zero 'Neg1 'Pos1 'Pos1 'Zero 'Zero 'Zero
type DAbsorbedDoseRate = 'Dim 'Pos2 'Zero 'Neg3 'Zero 'Zero 'Zero 'Zero
type DImpulse = 'Dim 'Pos1 'Pos1 'Neg1 'Zero 'Zero 'Zero 'Zero
type DMomentum = DImpulse
type DMassFlow = 'Dim 'Zero 'Pos1 'Neg1 'Zero 'Zero 'Zero 'Zero
type DVolumeFlow = 'Dim 'Pos3 'Zero 'Neg1 'Zero 'Zero 'Zero 'Zero
type DGravitationalParameter = 'Dim 'Pos3 'Zero 'Neg2 'Zero 'Zero 'Zero 'Zero
type DKinematicViscosity = 'Dim 'Pos2 'Zero 'Neg1 'Zero 'Zero 'Zero 'Zero
type DFirstMassMoment = 'Dim 'Pos1 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DMomentOfInertia = 'Dim 'Pos2 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DAngularMomentum = 'Dim 'Pos2 'Pos1 'Neg1 'Zero 'Zero 'Zero 'Zero
type DThermalResistivity = 'Dim 'Neg1 'Neg1 'Pos3 'Zero 'Pos1 'Zero 'Zero
type DThermalConductance = 'Dim 'Pos2 'Pos1 'Neg3 'Zero 'Neg1 'Zero 'Zero
type DThermalResistance = 'Dim 'Neg2 'Neg1 'Pos3 'Zero 'Pos1 'Zero 'Zero
type DHeatTransferCoefficient = 'Dim 'Zero 'Pos1 'Neg3 'Zero 'Neg1 'Zero 'Zero
type DThermalAdmittance = DHeatTransferCoefficient
type DThermalInsulance = 'Dim 'Zero 'Neg1 'Pos3 'Zero 'Pos1 'Zero 'Zero
type DJerk = 'Dim 'Pos1 'Zero 'Neg3 'Zero 'Zero 'Zero 'Zero
type DAngle = DPlaneAngle
type DThrust = DForce
type DTorque = DMomentOfForce
type DEnergyPerUnitMass = DSpecificEnergy


-- | <h1>Summary</h1>
--   
--   This module defines the SI prefixes, the SI base units and the SI
--   derived units. It also defines the units outside of the SI that are
--   accepted for use with the SI. Any chapters, sections or tables
--   referenced are from <a>[1]</a> unless otherwise specified.
--   
--   <h1>References</h1>
--   
--   <ol>
--   <li><a>http://physics.nist.gov/Pubs/SP811/</a></li>
--   <li><a>http://en.wikipedia.org/wiki/Minute_of_arc</a></li>
--   <li><a>http://en.wikipedia.org/wiki/Astronomical_unit</a></li>
--   </ol>
module Numeric.Units.Dimensional.SIUnits
metre :: Num a => Unit 'Metric DLength a
meter :: Num a => Unit 'Metric DLength a
gram :: Fractional a => Unit 'Metric DMass a
second :: Num a => Unit 'Metric DTime a
ampere :: Num a => Unit 'Metric DElectricCurrent a
kelvin :: Num a => Unit 'Metric DThermodynamicTemperature a
mole :: Num a => Unit 'Metric DAmountOfSubstance a
candela :: Num a => Unit 'Metric DLuminousIntensity a
radian :: Num a => Unit 'Metric DPlaneAngle a
steradian :: Num a => Unit 'Metric DSolidAngle a
hertz :: Num a => Unit 'Metric DFrequency a
newton :: Num a => Unit 'Metric DForce a
pascal :: Num a => Unit 'Metric DPressure a
joule :: Num a => Unit 'Metric DEnergy a
watt :: Num a => Unit 'Metric DPower a
coulomb :: Num a => Unit 'Metric DElectricCharge a
volt :: Num a => Unit 'Metric DElectricPotential a
farad :: Num a => Unit 'Metric DCapacitance a
ohm :: Num a => Unit 'Metric DElectricResistance a
siemens :: Num a => Unit 'Metric DElectricConductance a
weber :: Num a => Unit 'Metric DMagneticFlux a
tesla :: Num a => Unit 'Metric DMagneticFluxDensity a
henry :: Num a => Unit 'Metric DInductance a
lumen :: Num a => Unit 'Metric DLuminousFlux a
lux :: Num a => Unit 'Metric DIlluminance a
degreeCelsius :: Num a => Unit 'Metric DCelsiusTemperature a
fromDegreeCelsiusAbsolute :: Floating a => a -> ThermodynamicTemperature a
toDegreeCelsiusAbsolute :: Floating a => ThermodynamicTemperature a -> a
becquerel :: Num a => Unit 'Metric DActivity a
gray :: Num a => Unit 'Metric DAbsorbedDose a
sievert :: Num a => Unit 'Metric DDoseEquivalent a
katal :: Num a => Unit 'Metric DCatalyticActivity a
minute :: Num a => Unit 'NonMetric DTime a
hour :: Num a => Unit 'NonMetric DTime a
day :: Num a => Unit 'NonMetric DTime a
hectare :: Fractional a => Unit 'NonMetric DArea a
litre :: Fractional a => Unit 'Metric DVolume a
liter :: Fractional a => Unit 'Metric DVolume a
tonne :: Num a => Unit 'Metric DMass a
metricTon :: Num a => Unit 'Metric DMass a
degree :: Floating a => Unit 'NonMetric DPlaneAngle a
arcminute :: Floating a => Unit 'NonMetric DPlaneAngle a
arcsecond :: Floating a => Unit 'NonMetric DPlaneAngle a
degreeOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
minuteOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
secondOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
astronomicalUnit :: Num a => Unit 'NonMetric DLength a
deka :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
deca :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
hecto :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
kilo :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
mega :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
giga :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
tera :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
peta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
exa :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
zetta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
yotta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
deci :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
centi :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
milli :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
micro :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
nano :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
pico :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
femto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
atto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
zepto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
yocto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
data Prefix
applyPrefix :: Fractional a => Prefix -> Unit 'Metric d a -> Unit 'NonMetric d a

-- | A list of all <a>Prefix</a>es defined by the SI.
siPrefixes :: [Prefix]


-- | <h1>Summary</h1>
--   
--   This module supplies a convenient set of imports for working with the
--   dimensional package, including aliases for common <a>Quantity</a>s and
--   <a>Dimension</a>s, and a comprehensive set of SI units and units
--   accepted for use with the SI.
--   
--   It re-exports the <a>Prelude</a>, hiding arithmetic functions whose
--   names collide with the dimensionally-typed versions supplied by this
--   package.
module Numeric.Units.Dimensional.Prelude

-- | Dimensional values inhabit this class, which allows access to a
--   term-level representation of their dimension.
class HasDynamicDimension a => HasDimension a

-- | Obtains a term-level representation of a value's dimension.
dimension :: HasDimension a => a -> Dimension'

-- | 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
--   <a>Dimension</a> data kind.
data Dimension'
Dim' :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> Dimension'

-- | A KnownDimension is one for which we can construct a term-level
--   representation. Each validly constructed type of kind <a>Dimension</a>
--   has a <a>KnownDimension</a> instance.
--   
--   While <a>KnownDimension</a> is a constraint synonym, the presence of
--   <tt><a>KnownDimension</a> d</tt> in a context allows use of
--   <tt><a>dimension</a> :: <a>Proxy</a> d -&gt; <a>Dimension'</a></tt>.
type KnownDimension (d :: Dimension) = HasDimension (Proxy d)

-- | Cube root is a special case of <a>NRoot</a> with order 3.
type Cbrt d = NRoot d 'Pos3

-- | Square root is a special case of <a>NRoot</a> with order 2.
type Sqrt d = NRoot d 'Pos2

-- | Roots of dimensions corresponds to division of the base dimensions'
--   exponents by the order of the root.
type family NRoot (d :: Dimension) (x :: TypeInt)

-- | Powers of dimensions corresponds 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.
type family (d :: Dimension) ^ (x :: TypeInt)
infixr 8 ^

-- | The reciprocal of a dimension is defined as the result of dividing
--   <a>DOne</a> by it, or of negating each of the base dimensions'
--   exponents.
type Recip (d :: Dimension) = DOne / d

-- | Division of dimensions corresponds to subtraction of the base
--   dimensions' exponents.
type family (a :: Dimension) / (d :: Dimension)
infixl 7 /

-- | Multiplication of dimensions corresponds to adding of the base
--   dimensions' exponents.
type family (a :: Dimension) * (b :: Dimension)
infixl 7 *
type DLuminousIntensity = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1
type DAmountOfSubstance = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero
type DThermodynamicTemperature = 'Dim 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero
type DElectricCurrent = 'Dim 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
type DTime = 'Dim 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero
type DMass = 'Dim 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DLength = 'Dim 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero

-- | The type-level dimension of dimensionless values.
type DOne = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero

-- | 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:
--   
--   <ul>
--   <li>l: Length</li>
--   <li>m: Mass</li>
--   <li>t: Time</li>
--   <li>i: Electric current</li>
--   <li>th: Thermodynamic temperature</li>
--   <li>n: Amount of substance</li>
--   <li>j: Luminous intensity</li>
--   </ul>
--   
--   For the equivalent term-level representation, see <a>Dimension'</a>
data Dimension
Dim :: TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> Dimension

-- | Encodes whether a unit is a metric unit, that is, whether it can be
--   combined with a metric prefix to form a related unit.
data Metricality

-- | Capable of receiving a metric prefix.
Metric :: Metricality

-- | Incapable of receiving a metric prefix.
NonMetric :: Metricality

-- | A KnownVariant is one whose term-level <a>Dimensional</a> values we
--   can represent with an associated data family instance and manipulate
--   with certain functions, not all of which are exported from the
--   package.
--   
--   Each validly constructed type of kind <a>Variant</a> has a
--   <a>KnownVariant</a> instance.
class KnownVariant (v :: Variant) where {
    
    -- | A dimensional value, either a <a>Quantity</a> or a <a>Unit</a>,
    --   parameterized by its <a>Dimension</a> and representation.
    data family Dimensional v :: Dimension -> Type -> Type;
}

-- | A dimensional quantity.
type Quantity = SQuantity One

-- | A unit of measurement.
type Unit (m :: Metricality) = Dimensional ('DUnit m)

-- | A polymorphic <a>Unit</a> which can be used in place of the coherent
--   SI base unit of any dimension. This allows polymorphic quantity
--   creation and destruction without exposing the <a>Dimensional</a>
--   constructor.
siUnit :: forall d a. (KnownDimension d, Num a) => Unit 'NonMetric d a

-- | Shows the value of a <a>Quantity</a> expressed in a specified
--   <a>Unit</a> of the same <a>Dimension</a>.
--   
--   Uses non-breaking spaces between the value and the unit, and within
--   the unit name.
--   
--   <pre>
--   &gt;&gt;&gt; putStrLn $ showIn watt $ (37 *~ volt) * (4 *~ ampere)
--   148.0 W
--   </pre>
showIn :: (Show a, Fractional a) => Unit m d a -> Quantity d a -> String
type LuminousIntensity = Quantity DLuminousIntensity
type AmountOfSubstance = Quantity DAmountOfSubstance
type ThermodynamicTemperature = Quantity DThermodynamicTemperature
type ElectricCurrent = Quantity DElectricCurrent
type Time = Quantity DTime
type Mass = Quantity DMass
type Length = Quantity DLength
type Dimensionless = Quantity DOne

-- | Extracts the <a>UnitName</a> of a <a>Unit</a>.
name :: Unit m d a -> UnitName m

-- | Extracts the exact value of a <a>Unit</a>, expressed in terms of the
--   SI coherent derived unit (see <a>siUnit</a>) of the same
--   <a>Dimension</a>.
--   
--   Note that the actual value may in some cases be approximate, for
--   example if the unit is defined by experiment.
exactValue :: Unit m d a -> ExactPi

-- | Discards potentially unwanted type level information about a
--   <a>Unit</a>.
weaken :: Unit m d a -> Unit 'NonMetric d a

-- | Attempts to convert a <a>Unit</a> which may or may not be
--   <a>Metric</a> to one which is certainly <a>Metric</a>.
strengthen :: Unit m d a -> Maybe (Unit 'Metric d a)

-- | Forms the exact version of a <a>Unit</a>.
exactify :: Unit m d a -> Unit m d ExactPi

-- | Forms a <a>Quantity</a> by multipliying a number and a unit.
(*~) :: Num a => a -> Unit m d a -> Quantity d a
infixl 7 *~

-- | Divides a <a>Quantity</a> by a <a>Unit</a> of the same physical
--   dimension, obtaining the numerical value of the quantity expressed in
--   that unit.
(/~) :: Fractional a => Quantity d a -> Unit m d a -> a
infixl 7 /~

-- | Multiplies two <a>Quantity</a>s or two <a>Unit</a>s.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <a>NonMetric</a>.
(*) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 * v2), Num a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 * v2) (d1 * d2) a
infixl 7 *

-- | Divides one <a>Quantity</a> by another or one <a>Unit</a> by another.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <tt>NotPrefixable</tt>.
(/) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 / v2), Fractional a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 / v2) (d1 / d2) a
infixl 7 /

-- | Forms the reciprocal of a <a>Quantity</a>, which has the reciprocal
--   dimension.
--   
--   <pre>
--   &gt;&gt;&gt; recip $ 47 *~ hertz
--   2.127659574468085e-2 s
--   </pre>
recip :: Fractional a => Quantity d a -> Quantity (Recip d) a

-- | Raises a <a>Quantity</a> or <a>Unit</a> to an integer power.
--   
--   Because the power chosen impacts the <a>Dimension</a> of the result,
--   it is necessary to supply a type-level representation of the exponent
--   in the form of a <a>Proxy</a> to some <tt>TypeInt</tt>. Convenience
--   values <tt>pos1</tt>, <a>pos2</a>, <tt>neg1</tt>, ... are supplied by
--   the <a>Numeric.NumType.DK.Integers</a> module. The most commonly used
--   ones are also reexported by <a>Numeric.Units.Dimensional.Prelude</a>.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <tt>NotPrefixable</tt>.
(^) :: (Fractional a, KnownTypeInt i, KnownVariant v, KnownVariant (Weaken v)) => Dimensional v d1 a -> Proxy i -> Dimensional (Weaken v) (d1 ^ i) a
infixr 8 ^

-- | Negates the value of a <a>Quantity</a>.
negate :: Num a => Quantity d a -> Quantity d a

-- | Adds two <a>Quantity</a>s.
(+) :: Num a => Quantity d a -> Quantity d a -> Quantity d a
infixl 6 +

-- | Subtracts one <a>Quantity</a> from another.
(-) :: Num a => Quantity d a -> Quantity d a -> Quantity d a
infixl 6 -

-- | Takes the absolute value of a <a>Quantity</a>.
abs :: Num a => Quantity d a -> Quantity d a

-- | Takes the sign of a <a>Quantity</a>. The functions <a>abs</a> and
--   <a>signum</a> satisy the law that:
--   
--   <pre>
--   abs x * signum x == x
--   </pre>
--   
--   The sign is either <tt>negate _1</tt> (negative), <tt>_0</tt> (zero),
--   or <tt>_1</tt> (positive).
signum :: Num a => Quantity d a -> Dimensionless a

-- | Computes the nth root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application of this operator
--   where the result would have a fractional dimension or where n is zero.
--   
--   Because the root chosen impacts the <a>Dimension</a> of the result, it
--   is necessary to supply a type-level representation of the root in the
--   form of a <a>Proxy</a> to some <tt>TypeInt</tt>. Convenience values
--   <tt>pos1</tt>, <a>pos2</a>, <tt>neg1</tt>, ... are supplied by the
--   <a>Numeric.NumType.DK.Integers</a> module. The most commonly used ones
--   are also reexported by <a>Numeric.Units.Dimensional.Prelude</a>.
--   
--   n must not be zero. Negative roots are defined such that <tt>nroot
--   (Proxy :: Proxy (Negate n)) x == nroot (Proxy :: Proxy n) (recip
--   x)</tt>.
--   
--   Also available in operator form, see <a>^/</a>.
nroot :: (KnownTypeInt n, Floating a) => Proxy n -> Quantity d a -> Quantity (NRoot d n) a

-- | Computes the square root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application where the
--   supplied quantity does not have a square dimension.
--   
--   <pre>
--   (x :: Area Double) &gt;= _0 ==&gt; sqrt x == nroot pos2 x
--   </pre>
sqrt :: Floating a => Quantity d a -> Quantity (Sqrt d) a

-- | Computes the cube root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application where the
--   supplied quantity does not have a cubic dimension.
--   
--   <pre>
--   (x :: Volume Double) &gt;= _0 ==&gt; cbrt x == nroot pos3 x
--   </pre>
cbrt :: Floating a => Quantity d a -> Quantity (Cbrt d) a

-- | Computes the nth root of a <a>Quantity</a> using <a>**</a>.
--   
--   The <a>NRoot</a> type family will prevent application of this operator
--   where the result would have a fractional dimension or where n is zero.
--   
--   Because the root chosen impacts the <a>Dimension</a> of the result, it
--   is necessary to supply a type-level representation of the root in the
--   form of a <a>Proxy</a> to some <tt>TypeInt</tt>. Convenience values
--   <tt>pos1</tt>, <a>pos2</a>, <tt>neg1</tt>, ... are supplied by the
--   <a>Numeric.NumType.DK.Integers</a> module. The most commonly used ones
--   are also reexported by <a>Numeric.Units.Dimensional.Prelude</a>.
--   
--   Also available in prefix form, see <a>nroot</a>.
(^/) :: (KnownTypeInt n, Floating a) => Quantity d a -> Proxy n -> Quantity (NRoot d n) a
infixr 8 ^/

-- | Applies <a>*~</a> to all values in a functor.
(*~~) :: (Functor f, Num a) => f a -> Unit m d a -> f (Quantity d a)
infixl 7 *~~

-- | Applies <a>/~</a> to all values in a functor.
(/~~) :: forall f m d a. (Functor f, Fractional a) => f (Quantity d a) -> Unit m d a -> f a
infixl 7 /~~

-- | The sum of all elements in a foldable structure.
--   
--   <pre>
--   &gt;&gt;&gt; sum ([] :: [Mass Double])
--   0.0 kg
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; sum [12.4 *~ meter, 1 *~ foot]
--   12.7048 m
--   </pre>
sum :: (Num a, Foldable f) => f (Quantity d a) -> Quantity d a

-- | The product of all elements in a foldable structure.
--   
--   <pre>
--   &gt;&gt;&gt; product ([] :: [Dimensionless Double])
--   1.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; product [pi, _4, 0.36 *~ one]
--   4.523893421169302
--   </pre>
product :: (Num a, Foldable f) => f (Dimensionless a) -> Dimensionless a

-- | The arithmetic mean of all elements in a foldable structure.
--   
--   <pre>
--   &gt;&gt;&gt; mean [pi, _7]
--   5.070796326794897
--   </pre>
mean :: (Fractional a, Foldable f) => f (Quantity d a) -> Quantity d a

-- | The length of the foldable data structure as a <a>Dimensionless</a>.
--   This can be useful for purposes of e.g. calculating averages.
--   
--   <pre>
--   &gt;&gt;&gt; dimensionlessLength ["foo", "bar"]
--   2
--   </pre>
dimensionlessLength :: (Num a, Foldable f) => f b -> Dimensionless a

-- | Returns a list of quantities between given bounds.
--   
--   <pre>
--   n &lt;= 0 ==&gt; nFromTo (x :: Mass Double) (y :: Mass Double) n == [x, y]
--   </pre>
--   
--   <pre>
--   (x :: Length Double) &lt;= (y :: Length Double) ==&gt; all (\z -&gt; x &lt;= z &amp;&amp; z &lt;= y) (nFromTo x y n)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nFromTo _0 _3 2
--   [0.0,1.0,2.0,3.0]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nFromTo _1 _0 7
--   [1.0,0.875,0.75,0.625,0.5,0.375,0.25,0.125,0.0]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nFromTo _0 _1 (-5)
--   [0.0,1.0]
--   </pre>
nFromTo :: (Fractional a, Integral b) => Quantity d a -> Quantity d a -> b -> [Quantity d a]
exp :: Floating a => Dimensionless a -> Dimensionless a
log :: Floating a => Dimensionless a -> Dimensionless a
sin :: Floating a => Dimensionless a -> Dimensionless a
cos :: Floating a => Dimensionless a -> Dimensionless a
tan :: Floating a => Dimensionless a -> Dimensionless a
asin :: Floating a => Dimensionless a -> Dimensionless a
acos :: Floating a => Dimensionless a -> Dimensionless a
atan :: Floating a => Dimensionless a -> Dimensionless a
sinh :: Floating a => Dimensionless a -> Dimensionless a
cosh :: Floating a => Dimensionless a -> Dimensionless a
tanh :: Floating a => Dimensionless a -> Dimensionless a
asinh :: Floating a => Dimensionless a -> Dimensionless a
acosh :: Floating a => Dimensionless a -> Dimensionless a
atanh :: Floating a => Dimensionless a -> Dimensionless a
log1p :: Floating a => Dimensionless a -> Dimensionless a
expm1 :: Floating a => Dimensionless a -> Dimensionless a
log1pexp :: Floating a => Dimensionless a -> Dimensionless a
log1mexp :: Floating a => Dimensionless a -> Dimensionless a

-- | Raises a dimensionless quantity to a dimensionless power.
(**) :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a
infixr 8 **

-- | Takes the logarithm of the second argument in the base of the first.
--   
--   <pre>
--   &gt;&gt;&gt; logBase _2 _8
--   3.0
--   </pre>
logBase :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a

-- | The standard two argument arctangent function. Since it interprets its
--   two arguments in comparison with one another, the input may have any
--   dimension.
--   
--   <pre>
--   &gt;&gt;&gt; atan2 _0 _1
--   0.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; atan2 _1 _0
--   1.5707963267948966
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; atan2 _0 (negate _1)
--   3.141592653589793
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; atan2 (negate _1) _0
--   -1.5707963267948966
--   </pre>
atan2 :: RealFloat a => Quantity d a -> Quantity d a -> Dimensionless a

-- | The unit <a>one</a> has dimension <a>DOne</a> and is the base unit of
--   dimensionless values.
--   
--   As detailed in 7.10 "Values of quantities expressed simply as numbers:
--   the unit one, symbol 1" of <a>[1]</a> the unit one generally does not
--   appear in expressions. However, for us it is necessary to use
--   <a>one</a> as we would any other unit to perform the "boxing" of
--   dimensionless values.
one :: Num a => Unit 'NonMetric DOne a

-- | The constant for zero is polymorphic, allowing it to express zero
--   <a>Length</a> or <a>Capacitance</a> or <a>Velocity</a> etc, in
--   addition to the <a>Dimensionless</a> value zero.
_0 :: Num a => Quantity d a
_1 :: Num a => Dimensionless a
_2 :: Num a => Dimensionless a
_3 :: Num a => Dimensionless a
_4 :: Num a => Dimensionless a
_5 :: Num a => Dimensionless a
_6 :: Num a => Dimensionless a
_7 :: Num a => Dimensionless a
_8 :: Num a => Dimensionless a
_9 :: Num a => Dimensionless a
pi :: Floating a => Dimensionless a

-- | Twice <a>pi</a>.
--   
--   For background on <a>tau</a> see
--   <a>http://tauday.com/tau-manifesto</a> (but also feel free to review
--   <a>http://www.thepimanifesto.com)</a>.
tau :: Floating a => Dimensionless a

-- | Convenient conversion between numerical types while retaining
--   dimensional information.
--   
--   <pre>
--   &gt;&gt;&gt; let x = (37 :: Rational) *~ poundMass
--   
--   &gt;&gt;&gt; changeRep x :: Mass Double
--   16.78291769 kg
--   </pre>
changeRep :: (KnownVariant v, Real a, Fractional b) => Dimensional v d a -> Dimensional v d b

-- | Convenient conversion from exactly represented values while retaining
--   dimensional information.
changeRepApproximate :: (KnownVariant v, Floating b) => Dimensional v d ExactPi -> Dimensional v d b

-- | Converts a <a>Unit</a> into a lens from <a>Quantity</a>s to values.
asLens :: Fractional a => Unit m d a -> forall f. Functor f => (a -> f a) -> Quantity d a -> f (Quantity d a)

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is
--   irrational or <a>Approximate</a>. See <a>mkUnitQ</a> for when it is
--   rational and <a>mkUnitZ</a> for when it is an integer.
--   
--   Note that supplying zero as a definining quantity is invalid, as the
--   library relies upon units forming a group under multiplication.
--   
--   Supplying negative defining quantities is allowed and handled
--   gracefully, but is discouraged on the grounds that it may be
--   unexpected by other readers.
mkUnitR :: Floating a => UnitName m -> ExactPi -> Unit m1 d a -> Unit m d a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is
--   rational. See <a>mkUnitZ</a> for when it is an integer and
--   <a>mkUnitR</a> for the general case.
--   
--   For more information see <a>mkUnitR</a>.
mkUnitQ :: Fractional a => UnitName m -> Rational -> Unit m1 d a -> Unit m d a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is an
--   integer. See <a>mkUnitQ</a> for when it is rational and <a>mkUnitR</a>
--   for the general case.
--   
--   For more information see <a>mkUnitR</a>.
mkUnitZ :: Num a => UnitName m -> Integer -> Unit m1 d a -> Unit m d a
pos5 :: Proxy 'Pos5
pos4 :: Proxy 'Pos4
pos3 :: Proxy 'Pos3
pos2 :: Proxy 'Pos2
pos1 :: Proxy 'Pos1
zero :: Proxy 'Zero
neg1 :: Proxy 'Neg1
neg2 :: Proxy 'Neg2
neg3 :: Proxy 'Neg3
neg4 :: Proxy 'Neg4
neg5 :: Proxy 'Neg5
class Category (cat :: k -> k -> Type)
id :: forall (a :: k). Category cat => cat a a
(.) :: forall (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
maximum :: (Foldable t, Ord a) => t a -> a
minimum :: (Foldable t, Ord a) => t a -> a
(++) :: [a] -> [a] -> [a]
seq :: a -> b -> b
filter :: (a -> Bool) -> [a] -> [a]
zip :: [a] -> [b] -> [(a, b)]
print :: Show a => a -> IO ()
fst :: (a, b) -> a
snd :: (a, b) -> b
otherwise :: Bool
map :: (a -> b) -> [a] -> [b]
($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
class Enum a
succ :: Enum a => a -> a
pred :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
class Fractional a => Floating a
class Num a => Fractional a
fromRational :: Fractional a => Rational -> a
class (Real a, Enum a) => Integral a
quot :: Integral a => a -> a -> a
rem :: Integral a => a -> a -> a
div :: Integral a => a -> a -> a
mod :: Integral a => a -> a -> a
quotRem :: Integral a => a -> a -> (a, a)
divMod :: Integral a => a -> a -> (a, a)
toInteger :: Integral a => a -> Integer
class Applicative m => Monad (m :: Type -> Type)
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
return :: Monad m => a -> m a
class Functor (f :: Type -> Type)
fmap :: Functor f => (a -> b) -> f a -> f b
(<$) :: Functor f => a -> f b -> f a
class Num a
fromInteger :: Num a => Integer -> a
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
class Read a
readsPrec :: Read a => Int -> ReadS a
readList :: Read a => ReadS [a]
class (Num a, Ord a) => Real a
toRational :: Real a => a -> Rational
class (RealFrac a, Floating a) => RealFloat a
floatRadix :: RealFloat a => a -> Integer
floatDigits :: RealFloat a => a -> Int
floatRange :: RealFloat a => a -> (Int, Int)
decodeFloat :: RealFloat a => a -> (Integer, Int)
encodeFloat :: RealFloat a => Integer -> Int -> a
exponent :: RealFloat a => a -> Int
significand :: RealFloat a => a -> a
scaleFloat :: RealFloat a => Int -> a -> a
isNaN :: RealFloat a => a -> Bool
isInfinite :: RealFloat a => a -> Bool
isDenormalized :: RealFloat a => a -> Bool
isNegativeZero :: RealFloat a => a -> Bool
isIEEE :: RealFloat a => a -> Bool
class (Real a, Fractional a) => RealFrac a
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
class Show a
showsPrec :: Show a => Int -> a -> ShowS
show :: Show a => a -> String
showList :: Show a => [a] -> ShowS
class Monad m => MonadFail (m :: Type -> Type)
fail :: MonadFail m => String -> m a
class Functor f => Applicative (f :: Type -> Type)
pure :: Applicative f => a -> f a
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
(*>) :: Applicative f => f a -> f b -> f b
(<*) :: Applicative f => f a -> f b -> f a
class Foldable (t :: Type -> Type)
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
null :: Foldable t => t a -> Bool
length :: Foldable t => t a -> Int
elem :: (Foldable t, Eq a) => a -> t a -> Bool
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
class Semigroup a
(<>) :: Semigroup a => a -> a -> a
class Semigroup a => Monoid a
mempty :: Monoid a => a
mappend :: Monoid a => a -> a -> a
mconcat :: Monoid a => [a] -> a
data Bool
False :: Bool
True :: Bool
data Char
data Double
data Float
data Int
data Integer
data Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
data Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering
type Rational = Ratio Integer
data IO a
data Word
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b
type ReadS a = String -> [(a, String)]
replicate :: Int -> a -> [a]
errorWithoutStackTrace :: forall (r :: RuntimeRep) (a :: TYPE r). [Char] -> a
type String = [Char]
type ShowS = String -> String
maybe :: b -> (a -> b) -> Maybe a -> b
const :: a -> b -> a
either :: (a -> c) -> (b -> c) -> Either a b -> c
all :: Foldable t => (a -> Bool) -> t a -> Bool
and :: Foldable t => t Bool -> Bool
any :: Foldable t => (a -> Bool) -> t a -> Bool
concat :: Foldable t => t [a] -> [a]
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
or :: Foldable t => t Bool -> Bool
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
(<$>) :: Functor f => (a -> b) -> f a -> f b
lines :: String -> [String]
unlines :: [String] -> String
unwords :: [String] -> String
words :: String -> [String]
curry :: ((a, b) -> c) -> a -> b -> c
uncurry :: (a -> b -> c) -> (a, b) -> c
($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
(=<<) :: Monad m => (a -> m b) -> m a -> m b
asTypeOf :: a -> a -> a
flip :: (a -> b -> c) -> b -> a -> c
until :: (a -> Bool) -> (a -> a) -> a -> a
error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
ioError :: IOError -> IO a
userError :: String -> IOError
(!!) :: [a] -> Int -> a
break :: (a -> Bool) -> [a] -> ([a], [a])
cycle :: [a] -> [a]
drop :: Int -> [a] -> [a]
dropWhile :: (a -> Bool) -> [a] -> [a]
head :: [a] -> a
init :: [a] -> [a]
iterate :: (a -> a) -> a -> [a]
last :: [a] -> a
lookup :: Eq a => a -> [(a, b)] -> Maybe b
repeat :: a -> [a]
reverse :: [a] -> [a]
scanl :: (b -> a -> b) -> b -> [a] -> [b]
scanl1 :: (a -> a -> a) -> [a] -> [a]
scanr :: (a -> b -> b) -> b -> [a] -> [b]
scanr1 :: (a -> a -> a) -> [a] -> [a]
span :: (a -> Bool) -> [a] -> ([a], [a])
splitAt :: Int -> [a] -> ([a], [a])
tail :: [a] -> [a]
take :: Int -> [a] -> [a]
takeWhile :: (a -> Bool) -> [a] -> [a]
unzip :: [(a, b)] -> ([a], [b])
unzip3 :: [(a, b, c)] -> ([a], [b], [c])
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
subtract :: Num a => a -> a -> a
lex :: ReadS String
readParen :: Bool -> ReadS a -> ReadS a
(^^) :: (Fractional a, Integral b) => a -> b -> a
even :: Integral a => a -> Bool
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
odd :: Integral a => a -> Bool
showChar :: Char -> ShowS
showParen :: Bool -> ShowS -> ShowS
showString :: String -> ShowS
shows :: Show a => a -> ShowS
appendFile :: FilePath -> String -> IO ()
getChar :: IO Char
getContents :: IO String
getLine :: IO String
interact :: (String -> String) -> IO ()
putChar :: Char -> IO ()
putStr :: String -> IO ()
putStrLn :: String -> IO ()
readFile :: FilePath -> IO String
readIO :: Read a => String -> IO a
readLn :: Read a => IO a
writeFile :: FilePath -> String -> IO ()
read :: Read a => String -> a
reads :: Read a => ReadS a
(&&) :: Bool -> Bool -> Bool
not :: Bool -> Bool
(||) :: Bool -> Bool -> Bool
type FilePath = String
type IOError = IOException


-- | <h1>Summary</h1>
--   
--   This module defines units that are not part of the SI, with the
--   exception of those defined in the
--   <a>Numeric.Units.Dimensional.SIUnits</a> module (units outside of the
--   SI accepted for use with the SI).
--   
--   Any chapters, sections or tables referenced are from <a>[1]</a> unless
--   otherwise specified.
--   
--   <h2>Neper, bel, shannon and the like</h2>
--   
--   The units of section 5.1.2 are purposefully (but not permanently)
--   omitted. In fact the logarithmic units (see section 8.7) are
--   problematic and it is not clear how to implement them. Perhaps with a
--   conversion function similar to for degrees Celsius.
--   
--   <h1>References</h1>
--   
--   <ol>
--   <li><a>http://physics.nist.gov/Pubs/SP811/</a></li>
--   
--   <li><a>http://www.iau.org/science/publications/proceedings_rules/units/</a></li>
--   <li><a>http://en.m.wikipedia.org/wiki/Pressure</a></li>
--   <li><a>http://en.m.wikipedia.org/wiki/Torr</a></li>
--   </ol>
module Numeric.Units.Dimensional.NonSI
electronVolt :: Floating a => Unit 'Metric DEnergy a
unifiedAtomicMassUnit :: Floating a => Unit 'Metric DMass a
dalton :: Floating a => Unit 'Metric DMass a

-- | One percent is one hundrendth.
--   
--   The dimensionless number 0.01 , represented by the symbol %, is
--   commonly used as a dimensionless unit.
--   
--   See section 7.10.2 of the <a>[1]</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ percent
--   1.0e-2
--   </pre>
percent :: Fractional a => Unit 'NonMetric DOne a

-- | One gee is the standard value of the acceleration due to gravity at
--   the Earth's surface, as standardized by CIPM.
--   
--   Note that local values of acceleration due to gravity will differ from
--   the standard gravity.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ gee
--   9.80665 m s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ gee :: Acceleration Rational
--   196133 % 20000 m s^-2
--   </pre>
gee :: Fractional a => Unit 'Metric DAcceleration a

-- | One avoirdupois pound is a mass, exactly defined in terms of the
--   kilogram by the international yard and pound agreement of 1959.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ poundMass
--   0.45359237 kg
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ poundMass :: Mass Rational
--   45359237 % 100000000 kg
--   </pre>
poundMass :: Fractional a => Unit 'NonMetric DMass a

-- | One avoirdupois ounce is one sixteenth of a <a>poundMass</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ ounce
--   2.8349523125e-2 kg
--   </pre>
--   
--   <pre>
--   16 *~ ounce === 1 *~ poundMass
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ ounce :: Mass Rational
--   45359237 % 1600000000 kg
--   </pre>
ounce :: Fractional a => Unit 'NonMetric DMass a

-- | The pound-force is equal to the gravitational force exerted on a mass
--   of one avoirdupois pound on the surface of Earth.
--   
--   This definition is based on standard gravity (the <a>gee</a>) and the
--   international avoirdupois <a>poundMass</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ poundForce
--   4.4482216152605 m kg s^-2
--   </pre>
--   
--   <pre>
--   1 *~ poundForce === 1 *~ poundMass * (1 *~ gee)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ poundForce :: Force Rational
--   8896443230521 % 2000000000000 m kg s^-2
--   </pre>
poundForce :: Fractional a => Unit 'NonMetric DForce a

-- | One mechanical horsepower is by definition the power necessary to
--   apply a force of 550 <a>poundForce</a> through a distance of one
--   <a>foot</a> per <a>second</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ horsepower
--   745.6998715822702 m^2 kg s^-3
--   </pre>
--   
--   <pre>
--   1 *~ horsepower === 550 *~ poundForce * (1 *~ foot) / (1 *~ second)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ horsepower :: Power Rational
--   37284993579113511 % 50000000000000 m^2 kg s^-3
--   </pre>
horsepower :: Fractional a => Unit 'NonMetric DPower a

-- | One btu is is the <a>QuantityOfHeat</a> required to raise the
--   temperature of 1 avoirdupois <a>poundMass</a> of liquid water by 1
--   <a>degreeFahrenheit</a> at a constant pressure of one
--   <a>atmosphere</a>.
--   
--   Because this value must be determined experimentally and varies with
--   temperature, several standardized values of the btu have arisen. This
--   is the value based on the International Steam Table calorie, defined
--   by the Fifth International Conference on the Properties of Steam.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ btu
--   1055.05585262 m^2 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ btu :: Energy Rational
--   52752792631 % 50000000 m^2 kg s^-2
--   </pre>
btu :: Fractional a => Unit 'NonMetric DEnergy a

-- | One short ton is two thousand <a>poundMass</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ shortTon
--   907.18474 kg
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ shortTon :: Mass Rational
--   45359237 % 50000 kg
--   </pre>
shortTon :: Fractional a => Unit 'NonMetric DMass a

-- | One nautical mile is a unit of length, set by international agreement
--   as being exactly 1 852 meters.
--   
--   Historically, it was defined as the distance spanned by one minute of
--   arc along a meridian of the Earth.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ nauticalMile
--   1852.0 m
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ nauticalMile :: Length Rational
--   1852 % 1 m
--   </pre>
nauticalMile :: Num a => Unit 'NonMetric DLength a

-- | One knot is a velocity equal to one <a>nauticalMile</a> per
--   <a>hour</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ knot
--   0.5144444444444445 m s^-1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ knot :: Velocity Rational
--   463 % 900 m s^-1
--   </pre>
knot :: Fractional a => Unit 'NonMetric DVelocity a

-- | One revolution is an angle equal to 2 pi radians; a full circle.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ revolution
--   6.283185307179586
--   </pre>
--   
--   <pre>
--   1 *~ revolution === _2 * pi * (1 *~ radian)
--   </pre>
--   
--   <pre>
--   1 *~ revolution === 360 *~ degree
--   </pre>
revolution :: Floating a => Unit 'NonMetric DOne a
solid :: Floating a => Unit 'NonMetric DOne a

-- | The slug is a unit of mass associated with Imperial units and United
--   States customary units. It is a mass that accelerates by 1 foot per
--   second per second when a force of one pound is exerted on it.
--   
--   This definition is based on standard gravity (the <a>gee</a>), the
--   international <a>foot</a>, and the international avoirdupois
--   <a>poundMass</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ slug
--   14.593902937206364 kg
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ slug :: Mass Rational
--   8896443230521 % 609600000000 kg
--   </pre>
slug :: Fractional a => Unit 'NonMetric DMass a

-- | One psi is a pressure of one <a>poundForce</a> per <a>square</a>
--   <a>inch</a> of area.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ psi
--   6894.757293168362 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ psi :: Pressure Rational
--   8896443230521 % 1290320000 m^-1 kg s^-2
--   </pre>
psi :: Fractional a => Unit 'NonMetric DPressure a
teaspoon :: Fractional a => Unit 'NonMetric DVolume a

-- | One international foot is one third of an international <a>yard</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ foot
--   0.3048 m
--   </pre>
--   
--   <pre>
--   3 *~ foot === 1 *~ yard
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ foot :: Length Rational
--   381 % 1250 m
--   </pre>
foot :: Fractional a => Unit 'NonMetric DLength a

-- | One inch is one twelth of a <a>foot</a>.
--   
--   This inch is based on the international <a>foot</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inch
--   2.54e-2 m
--   </pre>
--   
--   <pre>
--   12 *~ inch === 1 *~ foot
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inch :: Length Rational
--   127 % 5000 m
--   </pre>
inch :: Fractional a => Unit 'NonMetric DLength a

-- | One mil is one thousandth of an <a>inch</a>.
--   
--   This mil is based on the international <a>inch</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ mil
--   2.54e-5 m
--   </pre>
--   
--   <pre>
--   1000 *~ mil === 1 *~ inch
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ mil :: Length Rational
--   127 % 5000000 m
--   </pre>
mil :: Fractional a => Unit 'NonMetric DLength a

-- | One yard, as defined by international agreement in 1959, is precisely
--   0.9144 <a>meter</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ yard
--   0.9144 m
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ yard :: Length Rational
--   1143 % 1250 m
--   </pre>
yard :: Fractional a => Unit 'NonMetric DLength a

-- | One mile is 5 280 feet.
--   
--   This mile is based on the international <a>foot</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ mile
--   1609.344 m
--   </pre>
--   
--   <pre>
--   1 *~ mile === 5280 *~ foot
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ mile :: Length Rational
--   201168 % 125 m
--   </pre>
mile :: Fractional a => Unit 'NonMetric DLength a

-- | One acre is 43 560 square feet.
--   
--   This acre is based on the international <a>foot</a>. For the acre
--   based on the US Survey Foot, see <a>usSurveyAcre</a>. While both acres
--   are in use, the difference between them is of little consequence for
--   most applications in which either is used.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ acre
--   4046.8564224 m^2
--   </pre>
--   
--   <pre>
--   1 *~ acre === 43560 *~ foot ^ pos2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ acre :: Area Rational
--   316160658 % 78125 m^2
--   </pre>
acre :: Fractional a => Unit 'NonMetric DArea a

-- | One US survey foot is 1200/3937 <a>meter</a>.
--   
--   For the international foot, see <a>foot</a>. Note that this is not the
--   foot in routine use in the United States.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyFoot
--   0.3048006096012192 m
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyFoot :: Length Rational
--   1200 % 3937 m
--   </pre>
usSurveyFoot :: Fractional a => Unit 'NonMetric DLength a

-- | One inch is one twelth of a foot.
--   
--   This inch is based on the <a>usSurveyFoot</a>. For the inch based on
--   the international foot, see <a>inch</a>. Note that this is not the
--   inch in routine use in the United States.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyInch
--   2.54000508001016e-2 m
--   </pre>
--   
--   <pre>
--   12 *~ usSurveyInch === 1 *~ usSurveyFoot
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyInch :: Length Rational
--   100 % 3937 m
--   </pre>
usSurveyInch :: Fractional a => Unit 'NonMetric DLength a

-- | One mil is one thousandth of an inch.
--   
--   This mil is based on the <a>usSurveyInch</a>. For the mil based on the
--   international inch, see <a>mil</a>. Note that this is not the mil in
--   routine use in the United States.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyMil
--   2.54000508001016e-5 m
--   </pre>
--   
--   <pre>
--   1000 *~ usSurveyMil === 1 *~ usSurveyInch
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyMil :: Length Rational
--   1 % 39370 m
--   </pre>
usSurveyMil :: Fractional a => Unit 'NonMetric DLength a

-- | One yard is three feet.
--   
--   This yard is based on the <a>usSurveyFoot</a>. For the international
--   yard, see <a>yard</a>. Note that this is not the yard in routine use
--   in the United States.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyYard
--   0.9144018288036576 m
--   </pre>
--   
--   <pre>
--   1 *~ usSurveyYard === 3 *~ usSurveyFoot
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyYard :: Length Rational
--   3600 % 3937 m
--   </pre>
usSurveyYard :: Fractional a => Unit 'NonMetric DLength a

-- | One US survey mile is 5 280 US survey feet.
--   
--   This mile is based on the <a>usSurveyFoot</a>. For the mile based on
--   the international foot, see <a>mile</a>. Note that this is not the
--   mile in routine use in the United States.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyMile
--   1609.3472186944373 m
--   </pre>
--   
--   <pre>
--   1 *~ usSurveyMile === 5280 *~ usSurveyFoot
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyMile :: Length Rational
--   6336000 % 3937 m
--   </pre>
usSurveyMile :: Fractional a => Unit 'NonMetric DLength a

-- | One acre is 43 560 square feet.
--   
--   This acre is based on the <a>usSurveyFoot</a>. For the acre based on
--   the international foot, see <a>acre</a>. While both acres are in use,
--   the difference between them is of little consequence for most
--   applications in which either is used. This is the only acre defined by
--   the UCUM.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyAcre
--   4046.872609874252 m^2
--   </pre>
--   
--   <pre>
--   1 *~ usSurveyAcre === 43560 *~ usSurveyFoot ^ pos2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usSurveyAcre :: Area Rational
--   62726400000 % 15499969 m^2
--   </pre>
usSurveyAcre :: Fractional a => Unit 'NonMetric DArea a

-- | One mean Julian year is a unit of measurement of time defined as
--   exactly 365.25 days of 86 400 <a>second</a>s each.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ year
--   3.15576e7 s
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ year :: Time Rational
--   31557600 % 1 s
--   </pre>
year :: Num a => Unit 'NonMetric DTime a

-- | One mean Julian century is one hundred mean Julian <a>year</a>s.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ century
--   3.15576e9 s
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ century :: Time Rational
--   3155760000 % 1 s
--   </pre>
century :: Num a => Unit 'NonMetric DTime a

-- | The bar is exactly 100 000 <a>pascal</a>.
--   
--   From Wikipedia:
--   
--   It is about equal to the atmospheric pressure on Earth at sea level.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ bar
--   100000.0 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ bar :: Pressure Rational
--   100000 % 1 m^-1 kg s^-2
--   </pre>
bar :: Num a => Unit 'Metric DPressure a

-- | The "standard atmosphere".
--   
--   From Wikipedia <a>[3]</a>:
--   
--   The standard atmosphere (atm) is an established constant. It is
--   approximately equal to typical air pressure at earth mean sea level.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ atmosphere
--   101325.0 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ atmosphere :: Pressure Rational
--   101325 % 1 m^-1 kg s^-2
--   </pre>
atmosphere :: Num a => Unit 'NonMetric DPressure a

-- | The "technical atmosphere"
--   
--   From Wikipedia:
--   
--   A technical atmosphere (symbol: at) is a non-SI unit of pressure equal
--   to one kilogram-force per square centimeter.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ technicalAtmosphere
--   98066.5 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ technicalAtmosphere :: Pressure Rational
--   196133 % 2 m^-1 kg s^-2
--   </pre>
technicalAtmosphere :: Fractional a => Unit 'NonMetric DPressure a

-- | The conventional value for the pressure exerted by a 1 mm high column
--   of mercury.
--   
--   Per Wikipedia <a>[4]</a>, one mmHg (millimeter of mercury) is defined
--   as:
--   
--   The pressure exerted at the base of a column of fluid exactly 1 mm
--   high, when the density of the fluid is exactly 13.5951 g/cm^3, at a
--   place where the acceleration of gravity is exactly 9.80665 m/s^2.
--   
--   The chosen fluid density approximately corresponds to that of mercury
--   at 0 deg. Under most conditions, 1 mmHg is approximately equal to 1
--   <a>torr</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ mmHg
--   133.322 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ mmHg :: Pressure Rational
--   66661 % 500 m^-1 kg s^-2
--   </pre>
mmHg :: Fractional a => Unit 'NonMetric DPressure a

-- | The conventional value for the pressure exerted by a 1 inch high
--   column of mercury.
--   
--   Column inches of mercury are also used to measure pressure, especially
--   in meteorological or aeronautical contexts in the United States.
--   
--   This is the value defined by UCUM. For the value defined by NIST, see
--   <a>inHg_NIST</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inHg
--   3386.3788 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inHg :: Pressure Rational
--   8465947 % 2500 m^-1 kg s^-2
--   </pre>
inHg :: Fractional a => Unit 'NonMetric DPressure a

-- | The conventional value for the pressure exerted by a 1 inch high
--   column of mercury.
--   
--   Column inches of mercury are also used to measure pressure, especially
--   in meteorological or aeronautical contexts in the United States.
--   
--   This is the value defined by UCUM. For the value defined by NIST, see
--   <a>inHg_NIST</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inHg_UCUM
--   3386.3788 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inHg_UCUM :: Pressure Rational
--   8465947 % 2500 m^-1 kg s^-2
--   </pre>
inHg_UCUM :: Fractional a => Unit 'NonMetric DPressure a

-- | The conventional value for the pressure exerted by a 1 inch high
--   column of mercury.
--   
--   Column inches of mercury are also used to measure pressure, especially
--   in meteorological or aeronautical contexts in the United States.
--   
--   This is the value defined by NIST. For the value defined by UCUM, see
--   <a>inHg_UCUM</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inHg_NIST
--   3386.389 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ inHg_NIST :: Pressure Rational
--   3386389 % 1000 m^-1 kg s^-2
--   </pre>
inHg_NIST :: Fractional a => Unit 'NonMetric DPressure a

-- | One torr (symbol: Torr) is defined as 1/760 <a>atmosphere</a>, which
--   is approximately equal to 1 <a>mmHg</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ torr
--   133.32236842105263 m^-1 kg s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ torr :: Pressure Rational
--   20265 % 152 m^-1 kg s^-2
--   </pre>
torr :: Fractional a => Unit 'NonMetric DPressure a

-- | The rad is a deprecated unit of <a>AbsorbedDose</a>, defined as 0.01
--   <a>gray</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ rad
--   1.0e-2 m^2 s^-2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ rad :: AbsorbedDose Rational
--   1 % 100 m^2 s^-2
--   </pre>
rad :: Fractional a => Unit 'Metric DAbsorbedDose a

-- | One Stokes is a unit of <a>KinematicViscosity</a> equal to <tt>1 cm^2
--   / s</tt>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ stokes
--   1.0e-4 m^2 s^-1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ stokes :: KinematicViscosity Rational
--   1 % 10000 m^2 s^-1
--   </pre>
stokes :: Fractional a => Unit 'Metric DKinematicViscosity a

-- | One degree Fahrenheit is a unit of relative temperature equal to 5/9
--   <a>kelvin</a>.
--   
--   Note that although the Fahrenheit scale is an absolute temperature
--   scale, this unit is a unit of difference within that scale and
--   measures relative temperature.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ degreeFahrenheit
--   0.5555555555555556 K
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ degreeFahrenheit :: ThermodynamicTemperature Rational
--   5 % 9 K
--   </pre>
degreeFahrenheit :: Fractional a => Unit 'NonMetric DThermodynamicTemperature a

-- | One degree Rankine is a unit of relative temperature equal to 5/9
--   <a>kelvin</a>.
--   
--   Note that although the Rankine scale is an absolute temperature scale,
--   this unit is a unit of difference within that scale and measures
--   relative temperature.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ degreeRankine
--   0.5555555555555556 K
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ degreeRankine :: ThermodynamicTemperature Rational
--   5 % 9 K
--   </pre>
degreeRankine :: Fractional a => Unit 'NonMetric DThermodynamicTemperature a

-- | One imperial gallon is defined exactly in terms of the <a>liter</a> by
--   the Weights and Measures Act 1985.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialGallon
--   4.54609e-3 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialGallon :: Volume Rational
--   454609 % 100000000 m^3
--   </pre>
imperialGallon :: Fractional a => Unit 'NonMetric DVolume a

-- | One imperial quart is one quarter of an <a>imperialGallon</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialQuart
--   1.1365225e-3 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialQuart :: Volume Rational
--   454609 % 400000000 m^3
--   </pre>
imperialQuart :: Fractional a => Unit 'NonMetric DVolume a

-- | One imperial pint is one half of an <a>imperialQuart</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialPint
--   5.6826125e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialPint :: Volume Rational
--   454609 % 800000000 m^3
--   </pre>
imperialPint :: Fractional a => Unit 'NonMetric DVolume a

-- | One imperial cup is one half of an <a>imperialPint</a>.
--   
--   This unit is not in common use and is does not appear in some sources
--   describing the imperial fluid volume units.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialCup
--   2.84130625e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialCup :: Volume Rational
--   454609 % 1600000000 m^3
--   </pre>
imperialCup :: Fractional a => Unit 'NonMetric DVolume a

-- | One imperial gill is one quarter of an <a>imperialPint</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialGill
--   1.420653125e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialGill :: Volume Rational
--   454609 % 3200000000 m^3
--   </pre>
imperialGill :: Fractional a => Unit 'NonMetric DVolume a

-- | One imperial fluid ounce is one twentieth of an <a>imperialPint</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialFluidOunce
--   2.84130625e-5 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ imperialFluidOunce :: Volume Rational
--   454609 % 16000000000 m^3
--   </pre>
imperialFluidOunce :: Fractional a => Unit 'NonMetric DVolume a

-- | One US liquid gallon is a volume of 231 cubic inches.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usGallon
--   3.785411784e-3 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usGallon :: Volume Rational
--   473176473 % 125000000000 m^3
--   </pre>
usGallon :: Fractional a => Unit 'NonMetric DVolume a

-- | One US liquid quart is one quarter of a <a>usGallon</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usQuart
--   9.46352946e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usQuart :: Volume Rational
--   473176473 % 500000000000 m^3
--   </pre>
usQuart :: Fractional a => Unit 'NonMetric DVolume a

-- | One US liquid pint is one half of a <a>usQuart</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usPint
--   4.73176473e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usPint :: Volume Rational
--   473176473 % 1000000000000 m^3
--   </pre>
usPint :: Fractional a => Unit 'NonMetric DVolume a

-- | One US liquid cup is one half of a <a>usPint</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usCup
--   2.365882365e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usCup :: Volume Rational
--   473176473 % 2000000000000 m^3
--   </pre>
usCup :: Fractional a => Unit 'NonMetric DVolume a

-- | One US liquid gill is one half of a <a>usCup</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usGill
--   1.1829411825e-4 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usGill :: Volume Rational
--   473176473 % 4000000000000 m^3
--   </pre>
usGill :: Fractional a => Unit 'NonMetric DVolume a

-- | One US fluid ounce is 1<i>128 <a>usGallon</a> or 1</i>8 <a>usCup</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usFluidOunce
--   2.95735295625e-5 m^3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ usFluidOunce :: Volume Rational
--   473176473 % 16000000000000 m^3
--   </pre>
usFluidOunce :: Fractional a => Unit 'NonMetric DVolume a

-- | One Ångström is 1/10 <a>nano</a> <a>meter</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ angstrom
--   1.0e-10 m
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ angstrom :: Length Rational
--   1 % 10000000000 m
--   </pre>
angstrom :: Fractional a => Unit 'NonMetric DLength a

-- | One Gauss is 1/10000 <a>tesla</a>.
--   
--   See <a>here</a> for further information.
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ gauss
--   1.0e-4 kg s^-2 A^-1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 1 *~ gauss :: MagneticFluxDensity Rational
--   1 % 10000 kg s^-2 A^-1
--   </pre>
gauss :: Fractional a => Unit 'NonMetric DMagneticFluxDensity a


-- | Defines convenience functions for inspecting and manipulating
--   quantities with <a>RealFloat</a> floating-point representations.
--   
--   The dimensionally-typed versions of functions from Patrick Perry's
--   <tt>ieee754</tt> package copy that package's API as closely as
--   possible, by permission. In turn they are based on the <tt>tango</tt>
--   math library for the D language.
module Numeric.Units.Dimensional.Float

-- | <a>True</a> if the representation of the argument is too small to be
--   represented in normalized format.
isDenormalized :: RealFloat a => Quantity d a -> Bool

-- | <a>True</a> if the representation of the argument is an IEEE infinity
--   or negative infinity.
--   
--   <pre>
--   &gt;&gt;&gt; isInfinite (_1 / _0)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isInfinite (42 *~ micro farad)
--   False
--   </pre>
isInfinite :: RealFloat a => Quantity d a -> Bool

-- | <a>True</a> if the representation of the argument is an IEEE
--   "not-a-number" (NaN) value.
--   
--   <pre>
--   &gt;&gt;&gt; isNaN _3
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isNaN (_1 / _0)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isNaN (asin _4)
--   True
--   </pre>
isNaN :: RealFloat a => Quantity d a -> Bool

-- | <a>True</a> if the representation of the argument is an IEEE negative
--   zero.
--   
--   <pre>
--   &gt;&gt;&gt; isNegativeZero _0
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isNegativeZero $ (-1e-200 *~ one) * (1e-200 *~ one)
--   True
--   </pre>
isNegativeZero :: RealFloat a => Quantity d a -> Bool

-- | <a>True</a> if the representation of the argument is a number and is
--   not infinite.
--   
--   <pre>
--   &gt;&gt;&gt; isFiniteNumber (_1 / _0)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isFiniteNumber (_0 / _0)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isFiniteNumber (_3 / _2)
--   True
--   </pre>
isFiniteNumber :: RealFloat a => Quantity d a -> Bool

-- | Multiplies a floating-point quantity by an integer power of the radix
--   of the representation type.
--   
--   Use <a>floatRadix</a> to determine the radix.
--   
--   <pre>
--   &gt;&gt;&gt; let x = 3 *~ meter
--   
--   &gt;&gt;&gt; scaleFloat 3 x
--   24.0 m
--   </pre>
scaleFloat :: RealFloat a => Int -> Quantity d a -> Quantity d a

-- | An infinite floating-point quantity.
infinity :: IEEE a => Quantity d a

-- | The smallest representable positive quantity whose representation is
--   normalized.
minNormal :: IEEE a => Quantity d a

-- | The largest representable finite floating-point quantity.
maxFinite :: IEEE a => Quantity d a

-- | The smallest positive value <tt>x</tt> such that <tt>_1 + x</tt> is
--   representable.
epsilon :: IEEE a => Dimensionless a

-- | Default <tt>NaN</tt> quantity.
nan :: IEEE a => Quantity d a

-- | Return the next smallest representable floating-point quantity
--   (<tt>Infinity</tt> and <tt>NaN</tt> are unchanged).
predIEEE :: IEEE a => Quantity d a -> Quantity d a

-- | Return the next largest representable floating-point quantity
--   (<tt>Infinity</tt> and <tt>NaN</tt> are unchanged).
succIEEE :: IEEE a => Quantity d a -> Quantity d a

-- | Given two floating-point quantities with the same sign, return the
--   quantity whose representation is halfway between their representations
--   on the IEEE number line. If the signs of the values differ or either
--   is <tt>NaN</tt>, the value is undefined.
bisectIEEE :: IEEE a => Quantity d a -> Quantity d a -> Quantity d a

-- | <tt>copySign x y</tt> returns the quantity <tt>x</tt> with its sign
--   changed to match that of <tt>y</tt>.
copySign :: IEEE a => Quantity d a -> Quantity d a -> Quantity d a

-- | Quiet <tt>NaN</tt> quantity with a positive integer payload. Payload
--   must be less than <tt>maxNaNPayload</tt> of the representation type.
--   
--   Beware that while some platforms allow using 0 as a payload, this
--   behavior is not portable.
nanWithPayload :: IEEE a => Word64 -> Quantity d a

-- | The payload stored in a <tt>NaN</tt> quantity. Undefined if the
--   argument is not <tt>NaN</tt>.
nanPayload :: IEEE a => Quantity d a -> Word64

-- | Maximum <tt>NaN</tt> payload for type <tt>a</tt>.
maxNaNPayload :: IEEE a => a -> Word64

-- | Return <a>True</a> if two floating-point quantities are <i>exactly</i>
--   (bitwise) equal.
identicalIEEE :: IEEE a => Quantity d a -> Quantity d a -> Bool

-- | Return the minimum of two quantities; if one value is <tt>NaN</tt>,
--   return the other. Prefer the first if both values are <tt>NaN</tt>.
minNum :: RealFloat a => Quantity d a -> Quantity d a -> Quantity d a

-- | Return the maximum of two quantities; if one value is <tt>NaN</tt>,
--   return the other. Prefer the first if both values are <tt>NaN</tt>.
maxNum :: RealFloat a => Quantity d a -> Quantity d a -> Quantity d a

-- | Return the minimum of two quantities; if one value is <tt>NaN</tt>,
--   return it. Prefer the first if both values are <tt>NaN</tt>.
minNaN :: RealFloat a => Quantity d a -> Quantity d a -> Quantity d a

-- | Return the maximum of two quantities; if one value is <tt>NaN</tt>,
--   return it. Prefer the first if both values are <tt>NaN</tt>.
maxNaN :: RealFloat a => Quantity d a -> Quantity d a -> Quantity d a


-- | Defines types for manipulation of quantities with fixed point
--   representations.
module Numeric.Units.Dimensional.FixedPoint

-- | A dimensional value, either a <a>Quantity</a> or a <a>Unit</a>,
--   parameterized by its <a>Dimension</a> and representation.
data family Dimensional v :: Dimension -> Type -> Type

-- | A unit of measurement.
type Unit (m :: Metricality) = Dimensional ('DUnit m)

-- | A dimensional quantity.
type Quantity = SQuantity One

-- | A dimensional quantity, stored as an <tt>ExactPi'</tt> multiple of its
--   value in its dimension's SI coherent unit.
--   
--   The name is an abbreviation for scaled quantity.
type SQuantity s = Dimensional ('DQuantity s)

-- | Encodes whether a unit is a metric unit, that is, whether it can be
--   combined with a metric prefix to form a related unit.
data Metricality

-- | Capable of receiving a metric prefix.
Metric :: Metricality

-- | Incapable of receiving a metric prefix.
NonMetric :: Metricality

-- | 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:
--   
--   <ul>
--   <li>l: Length</li>
--   <li>m: Mass</li>
--   <li>t: Time</li>
--   <li>i: Electric current</li>
--   <li>th: Thermodynamic temperature</li>
--   <li>n: Amount of substance</li>
--   <li>j: Luminous intensity</li>
--   </ul>
--   
--   For the equivalent term-level representation, see <a>Dimension'</a>
data Dimension
Dim :: TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> TypeInt -> Dimension

-- | Multiplication of dimensions corresponds to adding of the base
--   dimensions' exponents.
type family (a :: Dimension) * (b :: Dimension)
infixl 7 *

-- | Division of dimensions corresponds to subtraction of the base
--   dimensions' exponents.
type family (a :: Dimension) / (d :: Dimension)
infixl 7 /

-- | Powers of dimensions corresponds 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.
type family (d :: Dimension) ^ (x :: TypeInt)
infixr 8 ^

-- | Roots of dimensions corresponds to division of the base dimensions'
--   exponents by the order of the root.
type family NRoot (d :: Dimension) (x :: TypeInt)

-- | The reciprocal of a dimension is defined as the result of dividing
--   <a>DOne</a> by it, or of negating each of the base dimensions'
--   exponents.
type Recip (d :: Dimension) = DOne / d

-- | 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
--   <a>Dimension</a> data kind.
data Dimension'
Dim' :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> Dimension'

-- | Dimensional values inhabit this class, which allows access to a
--   term-level representation of their dimension.
class HasDynamicDimension a => HasDimension a

-- | Obtains a term-level representation of a value's dimension.
dimension :: HasDimension a => a -> Dimension'

-- | A KnownDimension is one for which we can construct a term-level
--   representation. Each validly constructed type of kind <a>Dimension</a>
--   has a <a>KnownDimension</a> instance.
--   
--   While <a>KnownDimension</a> is a constraint synonym, the presence of
--   <tt><a>KnownDimension</a> d</tt> in a context allows use of
--   <tt><a>dimension</a> :: <a>Proxy</a> d -&gt; <a>Dimension'</a></tt>.
type KnownDimension (d :: Dimension) = HasDimension (Proxy d)

-- | Forms a possibly scaled <a>SQuantity</a> by multipliying a number and
--   a unit.
(*~) :: forall s m d a b. (RealFrac a, Integral b, MinCtxt s a) => a -> Unit m d a -> SQuantity s d b
infixl 7 *~

-- | Divides a possibly scaled <a>SQuantity</a> by a <a>Unit</a> of the
--   same physical dimension, obtaining the numerical value of the quantity
--   expressed in that unit.
(/~) :: forall s m d a b. (Real a, Fractional b, MinCtxt s b) => SQuantity s d a -> Unit m d b -> b
infixl 7 /~

-- | Multiplies two <a>Quantity</a>s or two <a>Unit</a>s.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <a>NonMetric</a>.
(*) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 * v2), Num a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 * v2) (d1 * d2) a
infixl 7 *

-- | Divides one <a>Quantity</a> by another or one <a>Unit</a> by another.
--   
--   The intimidating type signature captures the similarity between these
--   operations and ensures that composite <a>Unit</a>s are
--   <tt>NotPrefixable</tt>.
(/) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 / v2), Fractional a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 / v2) (d1 / d2) a
infixl 7 /

-- | Adds two possibly scaled <a>SQuantity</a>s, preserving any scale
--   factor.
--   
--   Use in conjunction with <a>changeRepRound</a> to combine quantities
--   with differing scale factors.
(+) :: Num a => SQuantity s d a -> SQuantity s d a -> SQuantity s d a
infixl 6 +

-- | Subtracts one possibly scaled <a>SQuantity</a> from another,
--   preserving any scale factor.
--   
--   Use in conjunction with <a>changeRepRound</a> to combine quantities
--   with differing scale factors.
(-) :: Num a => SQuantity s d a -> SQuantity s d a -> SQuantity s d a
infixl 6 -

-- | Negates the value of a possibly scaled <a>SQuantity</a>, preserving
--   any scale factor.
negate :: Num a => SQuantity s d a -> SQuantity s d a

-- | Takes the absolute value of a possibly scaled <a>SQuantity</a>,
--   preserving any scale factor.
abs :: Num a => SQuantity s d a -> SQuantity s d a
expD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
logD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
sinD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
cosD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
tanD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
asinD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
acosD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
atanD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
sinhD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
coshD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
tanhD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
asinhD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
acoshD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b
atanhD :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne b

-- | The standard two argument arctangent function. Since it interprets its
--   two arguments in comparison with one another, the input may have any
--   dimension.
atan2D :: (Integral a, Integral b, MinCtxt s1 Double, MinCtxt s2 Double, MinCtxt s3 Double) => SQuantity s1 DOne a -> SQuantity s2 DOne a -> SQuantity s3 DOne b
expVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
logVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
sinVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
cosVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
tanVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
asinVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
acosVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
atanVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
sinhVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
coshVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
tanhVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
asinhVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
acoshVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c
atanhVia :: (Integral a, RealFrac b, Floating b, Integral c, MinCtxt s1 b, MinCtxt s2 b) => Proxy b -> SQuantity s1 DOne a -> SQuantity s2 DOne c

-- | The standard two argument arctangent function. Since it interprets its
--   two arguments in comparison with one another, the input may have any
--   dimension.
atan2Via :: forall s1 s2 s3 a b c d. (Integral a, RealFloat b, Integral c, MinCtxt s1 b, MinCtxt s2 b, MinCtxt s3 b, KnownDimension d) => Proxy b -> SQuantity s1 d a -> SQuantity s2 d a -> SQuantity s3 DOne c

-- | Applies <a>*~</a> to all values in a functor.
(*~~) :: (Functor f, RealFrac a, Integral b, MinCtxt s a) => f a -> Unit m d a -> f (SQuantity s d b)
infixl 7 *~~

-- | Applies <a>/~</a> to all values in a functor.
(/~~) :: (Functor f, Real a, Fractional b, MinCtxt s b) => f (SQuantity s d a) -> Unit m d b -> f b
infixl 7 /~~

-- | The sum of all elements in a list.
sum :: (Num a, Foldable f) => f (SQuantity s d a) -> SQuantity s d a

-- | The arithmetic mean of all elements in a list.
mean :: (Fractional a, Foldable f) => f (SQuantity s d a) -> SQuantity s d a

-- | Rescales a fixed point quantity, accomodating changes both in its
--   scale factor and its representation type.
--   
--   Note that this uses an arbitrary precision representation of
--   <a>pi</a>, which may be quite slow.
rescale :: forall a b d s1 s2. (Integral a, Integral b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b

-- | Rescales a fixed point quantity, accomodating changes both in its
--   scale factor and its representation type.
--   
--   Expected to outperform <a>rescale</a> when a <a>FiniteBits</a> context
--   is available for the source and destination representation types.
rescaleFinite :: (Integral a, FiniteBits a, Integral b, FiniteBits b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b

-- | Approximately rescales a fixed point quantity, accomodating changes
--   both in its scale factor and its representation type.
--   
--   Uses approximate arithmetic by way of an intermediate <a>Double</a>
--   representation.
rescaleD :: (Integral a, Integral b, KnownExactPi s1, KnownExactPi s2) => SQuantity s1 d a -> SQuantity s2 d b

-- | Approximately rescales a fixed point quantity, accomodating changes
--   both in its scale factor and its representation type.
--   
--   Uses approximate arithmetic by way of an intermediate <a>Floating</a>
--   type, to which a proxy must be supplied.
rescaleVia :: forall a b c d s1 s2. (Integral a, RealFrac b, Floating b, Integral c, KnownExactPi s1, KnownExactPi s2) => Proxy b -> SQuantity s1 d a -> SQuantity s2 d c

-- | A KnownVariant is one whose term-level <a>Dimensional</a> values we
--   can represent with an associated data family instance and manipulate
--   with certain functions, not all of which are exported from the
--   package.
--   
--   Each validly constructed type of kind <a>Variant</a> has a
--   <a>KnownVariant</a> instance.
class KnownVariant (v :: Variant)

-- | Maps over the underlying representation of a dimensional value. The
--   caller is responsible for ensuring that the supplied function respects
--   the dimensional abstraction. This means that the function must
--   preserve numerical values, or linearly scale them while preserving the
--   origin.
dmap :: KnownVariant v => (a1 -> a2) -> Dimensional v d a1 -> Dimensional v d a2

-- | Convenient conversion between numerical types while retaining
--   dimensional information.
changeRep :: forall v1 v2 d a b. (KnownVariant v1, KnownVariant v2, CompatibleVariants v1 v2, MinCtxt (ScaleFactor v1 / ScaleFactor v2) b, Real a, Fractional b) => Dimensional v1 d a -> Dimensional v2 d b

-- | Convenient conversion to types with <a>Integral</a> representations
--   using <a>round</a>.
changeRepRound :: forall v1 v2 d a b. (KnownVariant v1, KnownVariant v2, CompatibleVariants v1 v2, MinCtxt (ScaleFactor v1 / ScaleFactor v2) a, RealFrac a, Integral b) => Dimensional v1 d a -> Dimensional v2 d b

-- | Convenient conversion from exactly represented values while retaining
--   dimensional information.
changeRepApproximate :: (KnownVariant v, Floating b) => Dimensional v d ExactPi -> Dimensional v d b

-- | The type-level dimension of dimensionless values.
type DOne = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DLength = 'Dim 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero
type DMass = 'Dim 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero 'Zero
type DTime = 'Dim 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero 'Zero
type DElectricCurrent = 'Dim 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero 'Zero
type DThermodynamicTemperature = 'Dim 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero 'Zero
type DAmountOfSubstance = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1 'Zero
type DLuminousIntensity = 'Dim 'Zero 'Zero 'Zero 'Zero 'Zero 'Zero 'Pos1
type Dimensionless = Quantity DOne
type Length = Quantity DLength
type Mass = Quantity DMass
type Time = Quantity DTime
type ElectricCurrent = Quantity DElectricCurrent
type ThermodynamicTemperature = Quantity DThermodynamicTemperature
type AmountOfSubstance = Quantity DAmountOfSubstance
type LuminousIntensity = Quantity DLuminousIntensity

-- | The constant for zero is polymorphic, allowing it to express zero
--   <a>Length</a> or <a>Capacitance</a> or <a>Velocity</a> etc, in
--   addition to the <a>Dimensionless</a> value zero.
_0 :: Num a => SQuantity s d a

-- | The least positive representable value in a given fixed-point scaled
--   quantity type.
epsilon :: Integral a => SQuantity s d a
_1 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_2 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_3 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_4 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_5 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_6 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_7 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_8 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
_9 :: (Integral a, KnownExactPi s) => SQuantity s DOne a
pi :: (Integral a, KnownExactPi s) => SQuantity s DOne a

-- | Twice <a>pi</a>.
--   
--   For background on <a>tau</a> see
--   <a>http://tauday.com/tau-manifesto</a> (but also feel free to review
--   <a>http://www.thepimanifesto.com)</a>.
tau :: (Integral a, KnownExactPi s) => SQuantity s DOne a

-- | A polymorphic <a>Unit</a> which can be used in place of the coherent
--   SI base unit of any dimension. This allows polymorphic quantity
--   creation and destruction without exposing the <a>Dimensional</a>
--   constructor.
siUnit :: forall d a. (KnownDimension d, Num a) => Unit 'NonMetric d a

-- | The unit <a>one</a> has dimension <a>DOne</a> and is the base unit of
--   dimensionless values.
--   
--   As detailed in 7.10 "Values of quantities expressed simply as numbers:
--   the unit one, symbol 1" of <a>[1]</a> the unit one generally does not
--   appear in expressions. However, for us it is necessary to use
--   <a>one</a> as we would any other unit to perform the "boxing" of
--   dimensionless values.
one :: Num a => Unit 'NonMetric DOne a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is
--   irrational or <a>Approximate</a>. See <a>mkUnitQ</a> for when it is
--   rational and <a>mkUnitZ</a> for when it is an integer.
--   
--   Note that supplying zero as a definining quantity is invalid, as the
--   library relies upon units forming a group under multiplication.
--   
--   Supplying negative defining quantities is allowed and handled
--   gracefully, but is discouraged on the grounds that it may be
--   unexpected by other readers.
mkUnitR :: Floating a => UnitName m -> ExactPi -> Unit m1 d a -> Unit m d a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is
--   rational. See <a>mkUnitZ</a> for when it is an integer and
--   <a>mkUnitR</a> for the general case.
--   
--   For more information see <a>mkUnitR</a>.
mkUnitQ :: Fractional a => UnitName m -> Rational -> Unit m1 d a -> Unit m d a

-- | Forms a new atomic <a>Unit</a> by specifying its <a>UnitName</a> and
--   its definition as a multiple of another <a>Unit</a>.
--   
--   Use this variant when the scale factor of the resulting unit is an
--   integer. See <a>mkUnitQ</a> for when it is rational and <a>mkUnitR</a>
--   for the general case.
--   
--   For more information see <a>mkUnitR</a>.
mkUnitZ :: Num a => UnitName m -> Integer -> Unit m1 d a -> Unit m d a

-- | Extracts the <a>UnitName</a> of a <a>Unit</a>.
name :: Unit m d a -> UnitName m

-- | Extracts the exact value of a <a>Unit</a>, expressed in terms of the
--   SI coherent derived unit (see <a>siUnit</a>) of the same
--   <a>Dimension</a>.
--   
--   Note that the actual value may in some cases be approximate, for
--   example if the unit is defined by experiment.
exactValue :: Unit m d a -> ExactPi

-- | Discards potentially unwanted type level information about a
--   <a>Unit</a>.
weaken :: Unit m d a -> Unit 'NonMetric d a

-- | Attempts to convert a <a>Unit</a> which may or may not be
--   <a>Metric</a> to one which is certainly <a>Metric</a>.
strengthen :: Unit m d a -> Maybe (Unit 'Metric d a)

-- | Forms the exact version of a <a>Unit</a>.
exactify :: Unit m d a -> Unit m d ExactPi

-- | A dimensionless number with <tt>n</tt> fractional bits, using a
--   representation of type <tt>a</tt>.
type Q n a = SQuantity (QScale n) DOne a

-- | A binary scale factor.
type QScale n = (One / (ExactNatural (2 ^ n)))

-- | A single-turn angle represented as a signed 8-bit integer.
type Angle8 = SQuantity (Pi * (QScale 7)) DPlaneAngle Int8

-- | A single-turn angle represented as a signed 16-bit integer.
type Angle16 = SQuantity (Pi * (QScale 15)) DPlaneAngle Int16

-- | A single-turn angle represented as a signed 32-bit integer.
type Angle32 = SQuantity (Pi * (QScale 31)) DPlaneAngle Int32


-- | Provides a <a>Functor</a> instance for <a>Dimensional</a>.
--   
--   Note that this instance is dubious, because it allows you to break the
--   dimensional abstraction. See <a>dmap</a> for more information.
--   
--   Note that, while this instance overlaps with that given for
--   <a>Dimensionless</a>, it is confluent with that instance.
--   
--   Note that this is an orphan instance.
module Numeric.Units.Dimensional.Functor
instance Numeric.Units.Dimensional.Internal.KnownVariant v => GHC.Base.Functor (Numeric.Units.Dimensional.Internal.Dimensional v d)


-- | Defines types for manipulation of units and quantities without phantom
--   types for their dimensions.
module Numeric.Units.Dimensional.Dynamic

-- | A <a>Quantity</a> whose <a>Dimension</a> is only known dynamically.
data AnyQuantity a

-- | Possibly a <a>Quantity</a> whose <a>Dimension</a> is only known
--   dynamically.
--   
--   By modeling the absence of a value, this type differs from
--   <a>AnyQuantity</a> in that it may not be a <a>Quantity</a> of any
--   <a>Dimension</a> whatsoever, but in exchange it gains instances for
--   the common numeric classes. It's therefore useful for manipulating,
--   and not merely storing, quantities of unknown dimension.
--   
--   This type also contains a <a>polydimensionalZero</a>, representing
--   zero value of any dimension.
--   
--   Note that the <a>Eq</a> instance for <a>DynQuantity</a> equates all
--   representations of an invalid value, and also does not equate
--   polydimensional zero with zero of any specific dimension.
data DynQuantity a

-- | The class of types that can be used to model <a>Quantity</a>s that are
--   certain to have a value with some dimension.
class Demotable (q :: Type -> Type)

-- | The class of types that can be used to model <a>Quantity</a>s whose
--   <a>Dimension</a>s are only known dynamically.
class Promotable (q :: Type -> Type)

-- | Dimensional values, or those that are only possibly dimensional,
--   inhabit this class, which allows access to a term-level representation
--   of their dimension.
class HasDynamicDimension a

-- | Gets the 'DynamicDimension of a dynamic dimensional value, which may
--   be <a>NoDimension</a> if it does not represent a dimensional value of
--   any <tt>Dimension</tt>.
--   
--   A default implementation is available for types that are also in the
--   <a>HasDimension</a> typeclass.
dynamicDimension :: HasDynamicDimension a => a -> DynamicDimension

-- | Gets the 'DynamicDimension of a dynamic dimensional value, which may
--   be <a>NoDimension</a> if it does not represent a dimensional value of
--   any <tt>Dimension</tt>.
--   
--   A default implementation is available for types that are also in the
--   <a>HasDimension</a> typeclass.
dynamicDimension :: (HasDynamicDimension a, HasDimension a) => a -> DynamicDimension

-- | The dimension of a dynamic value, which may not have any dimension at
--   all.
data DynamicDimension

-- | The value has no valid dimension.
NoDimension :: DynamicDimension

-- | The value has the given dimension.
SomeDimension :: Dimension' -> DynamicDimension

-- | The value may be interpreted as having any dimension.
AnyDimension :: DynamicDimension

-- | Converts a dynamic quantity such as an <a>AnyQuantity</a> or a
--   <a>DynQuantity</a> into a <a>Quantity</a>, or to <a>Nothing</a> if the
--   dynamic quantity cannot be represented in the narrower result type.
promoteQuantity :: forall a d q. (Promotable q, KnownDimension d) => q a -> Maybe (Quantity d a)

-- | Forgets information about a <a>Quantity</a> or <a>AnyQuantity</a>,
--   yielding an <a>AnyQuantity</a> or a <a>DynQuantity</a>.
demoteQuantity :: (Demotable q, Promotable d) => q a -> d a

-- | Forms a dynamic quantity by multipliying a number and a dynamic unit.
(*~) :: (Floating a, Promotable q) => a -> AnyUnit -> q a

-- | Divides a dynamic quantity by a dynamic unit, obtaining the numerical
--   value of the quantity expressed in that unit if they are of the same
--   physical dimension, or <a>Nothing</a> otherwise.
(/~) :: (Floating a, Promotable q) => q a -> AnyUnit -> Maybe a

-- | A <a>DynQuantity</a> which does not correspond to a value of any
--   dimension.
invalidQuantity :: DynQuantity a

-- | A <a>DynQuantity</a> which corresponds to zero value of any dimension.
--   
--   When combined through arithmetic with other <a>DynQuantity</a>s,
--   inference is performed. For example, adding a length to
--   polydimensional zero produces that length. Adding two polydimensional
--   zeros produces another. Taking the sine of a polydimensional zero
--   interprets it as a dimensionless zero and produces a dimensionless
--   result.
--   
--   Note that division by <a>polydimensionalZero</a> produces a
--   polydimensional result, which may be an error or some representation
--   of infinity, as determined by the underlying arithmetic type. This
--   behavior was chosen for consistency with the behavior of division by
--   zero <a>DynQuantity</a>s of a specific dimension.
polydimensionalZero :: Num a => DynQuantity a

-- | A <a>Unit</a> whose <a>Dimension</a> is only known dynamically.
data AnyUnit

-- | Converts a <a>Unit</a> of statically known <a>Dimension</a> into an
--   <a>AnyUnit</a>.
demoteUnit :: forall m d a. KnownDimension d => Unit m d a -> AnyUnit

-- | Converts an <a>AnyUnit</a> into a <a>Unit</a> of statically known
--   <a>Dimension</a>, or <a>Nothing</a> if the dimension does not match.
--   
--   The result is represented in <a>ExactPi</a>, conversion to other
--   representations is possible using <a>changeRepApproximate</a>.
--   
--   The result is always tagged as <a>NonMetric</a>, conversion to a
--   <a>Metric</a> unit can be attempted using <a>strengthen</a>.
promoteUnit :: forall d. KnownDimension d => AnyUnit -> Maybe (Unit 'NonMetric d ExactPi)

-- | Converts a <a>Unit</a> of statically known <a>Dimension</a> into an
--   <a>AnyUnit</a>.
--   
--   This is the same as the more general <a>demoteUnit</a> but is useful
--   in certain circumstances to avoid needlessly introducing an ambiguous
--   type variable.
demoteUnit' :: KnownDimension d => Unit m d ExactPi -> AnyUnit

-- | The dynamic SI coherent unit of a given dimension.
siUnit :: Dimension' -> AnyUnit
anyUnitName :: AnyUnit -> UnitName 'NonMetric

-- | Forms the product of two dynamic units.
(*) :: AnyUnit -> AnyUnit -> AnyUnit

-- | Forms the quotient of two dynamic units.
(/) :: AnyUnit -> AnyUnit -> AnyUnit

-- | Raises a dynamic unit to an integer power.
(^) :: Integral a => AnyUnit -> a -> AnyUnit

-- | Forms the reciprocal of a dynamic unit.
recip :: AnyUnit -> AnyUnit

-- | Applies a prefix to a dynamic unit. Returns <a>Nothing</a> if the
--   <a>Unit</a> was <a>NonMetric</a> and thus could not accept a prefix.
applyPrefix :: Prefix -> AnyUnit -> Maybe AnyUnit
instance GHC.Generics.Generic Numeric.Units.Dimensional.Dynamic.AnyUnit
instance GHC.Generics.Generic1 Numeric.Units.Dimensional.Dynamic.DynQuantity
instance GHC.Generics.Generic (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance Data.Data.Data a => Data.Data.Data (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Generics.Generic1 Numeric.Units.Dimensional.Dynamic.AnyQuantity
instance GHC.Generics.Generic (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance Data.Data.Data a => Data.Data.Data (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance GHC.Show.Show Numeric.Units.Dimensional.Dynamic.AnyUnit
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDynamicDimension Numeric.Units.Dimensional.Dynamic.AnyUnit
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDimension Numeric.Units.Dimensional.Dynamic.AnyUnit
instance Numeric.Units.Dimensional.UnitNames.InterchangeNames.HasInterchangeName Numeric.Units.Dimensional.Dynamic.AnyUnit
instance GHC.Base.Semigroup Numeric.Units.Dimensional.Dynamic.AnyUnit
instance GHC.Base.Monoid Numeric.Units.Dimensional.Dynamic.AnyUnit
instance Numeric.Units.Dimensional.Dynamic.Promotable Numeric.Units.Dimensional.Dynamic.AnyQuantity
instance Numeric.Units.Dimensional.Dynamic.Promotable Numeric.Units.Dimensional.Dynamic.DynQuantity
instance GHC.Classes.Eq a => GHC.Classes.Eq (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Show.Show a => GHC.Show.Show (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDynamicDimension (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Num.Num a => GHC.Num.Num (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Real.Fractional a => GHC.Real.Fractional (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Float.Floating a => GHC.Float.Floating (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Num.Num a => GHC.Base.Semigroup (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance GHC.Num.Num a => GHC.Base.Monoid (Numeric.Units.Dimensional.Dynamic.DynQuantity a)
instance Numeric.Units.Dimensional.Dimensions.TypeLevel.KnownDimension d => Numeric.Units.Dimensional.Dynamic.Demotable (Numeric.Units.Dimensional.Internal.Quantity d)
instance Numeric.Units.Dimensional.Dynamic.Demotable Numeric.Units.Dimensional.Dynamic.AnyQuantity
instance GHC.Show.Show a => GHC.Show.Show (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDynamicDimension (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance Numeric.Units.Dimensional.Dimensions.TermLevel.HasDimension (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance GHC.Num.Num a => GHC.Base.Semigroup (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
instance GHC.Num.Num a => GHC.Base.Monoid (Numeric.Units.Dimensional.Dynamic.AnyQuantity a)
