Copyright | Copyright (C) 2006-2018 Bjorn Buckwalter |
---|---|
License | BSD3 |
Maintainer | bjorn@buckwalter.se |
Stability | Experimental |
Portability | GHC only? |
Safe Haskell | None |
Language | Haskell2010 |
Re-exports the raw Quantity
constructor from the Numeric.Units.Dimensional.Internal module, along with coerce
,
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
Quantity
constructor constructs a SQuantity
which may have a scale factor
other than One
.
Note that the haddock documentation doesn't mention the Quantity
constructor because it is a part of the
Dimensional
associated data family, but it is exported by this module.
Synopsis
- coerce :: Coercible a b => a -> b
- data family Dimensional v :: Dimension -> Type -> Type
- unQuantity :: SQuantity s d a -> a
Documentation
coerce :: Coercible a b => a -> b #
The function coerce
allows you to safely convert between values of
types that have the same representation with no run-time overhead. In the
simplest case you can use it instead of a newtype constructor, to go from
the newtype's concrete type to the abstract type. But it also works in
more complicated settings, e.g. converting a list of newtypes to a list of
concrete types.
data family Dimensional v :: Dimension -> Type -> Type Source #
A dimensional value, either a Quantity
or a Unit
, parameterized by its Dimension
and representation.