| Copyright | (C) 2014 Richard Eisenberg |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | Richard Eisenberg (rae@cs.brynmawr.edu) |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Metrology.Quantity
Description
Exports a class Quantity to allow easy conversion between proper
quantities and types from other libraries.
Synopsis
- class Quantity t where
- type QuantityUnit t :: *
- type QuantityLCSU t :: LCSU *
- type QuantityRep t :: *
- fromQuantity :: QuantityQu t -> t
- toQuantity :: t -> QuantityQu t
- type QuantityQu t = MkQu_ULN (QuantityUnit t) (QuantityLCSU t) (QuantityRep t)
Documentation
class Quantity t where Source #
Quantity allows for easy conversions in and out of quantities. For example,
say you are working with an outside library for time that defines UTCTime, where
that stores the time measured in seconds. You could say
instance Quantity UTCTime where type QuantityUnit = Second fromQuantity = ... toQuantity = ...
Then, conversions are easy and unit-safe.
Associated Types
type QuantityUnit t :: * Source #
The unit associated with t.
type QuantityLCSU t :: LCSU * Source #
The LCSU associated with t. Defaults to DefaultLCSU.
type QuantityRep t :: * Source #
The numerical representation associated with t. Defaults to Double.
Instances
| ValidDL d l => Quantity (Qu d l n) Source # | |
Defined in Data.Metrology.Quantity Associated Types type QuantityUnit (Qu d l n) :: Type Source # type QuantityLCSU (Qu d l n) :: LCSU Type Source # type QuantityRep (Qu d l n) :: Type Source # Methods fromQuantity :: QuantityQu (Qu d l n) -> Qu d l n Source # toQuantity :: Qu d l n -> QuantityQu (Qu d l n) Source # | |
type QuantityQu t = MkQu_ULN (QuantityUnit t) (QuantityLCSU t) (QuantityRep t) Source #