Copyright | Copyright (C) 2006-2014 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 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.
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.