units-2.4.1.2: A domain-specific type system for dimensional analysis

Copyright(C) 2014 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (rae@cs.brynmawr.edu)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Metrology.Quantity

Description

Exports a class Quantity to allow easy conversion between proper quantities and types from other libraries.

Synopsis

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 # 
Instance details

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 #

The Qu type associated with a member of the Quantity class