dimensional-1.0.1.3: Statically checked physical dimensions, using Type Families and Data Kinds.

Copyright | Copyright (C) 2006-2014 Bjorn Buckwalter
License | BSD3
Maintainer | bjorn@buckwalter.se
Stability | Experimental
Portability | GHC only?
Safe Haskell | None
Language | Haskell2010

Numeric.Units.Dimensional.Coercion

Description

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.

Synopsis

- coerce :: Coercible * a b => a -> b

# 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.