units- A domain-specific type system for dimensional analysis

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



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



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.

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 #


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