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

Copyright(C) 2014 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (eir@cis.upenn.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) 

type QuantityQu t = MkQu_ULN (QuantityUnit t) (QuantityLCSU t) (QuantityRep t) Source

The Qu type associated with a member of the Quantity class