| Copyright | (C) 2013 Richard Eisenberg |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | Richard Eisenberg (eir@cis.upenn.edu) |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Unsafe |
| Language | Haskell2010 |
Data.Metrology.Unsafe
Contents
Description
This module exports the constructor of the Qu type. This allows you
to write code that takes creates and reads quantities at will,
which may lead to dimension unsafety. Use at your peril.
This module also exports UnsafeQu, which is a simple wrapper around
Qu that has Functor, etc., instances. The reason Qu itself doesn't
have a Functor instance is that it would be unit-unsafe, allowing you,
say, to add 1 to a quantity.... but 1 what? That's the problem. However,
a Functor instance is likely useful, hence UnsafeQu.
The Qu type
Qu adds a dimensional annotation to its numerical value type
n. This is the representation for all quantities.
Constructors
| Qu n |
Instances
| Eq n => Eq (Qu d l n) | |
| ((~) [Factor *] d ([] (Factor *)), Floating n) => Floating (Qu d l n) | |
| ((~) [Factor *] d ([] (Factor *)), Fractional n) => Fractional (Qu d l n) | |
| ((~) [Factor *] d ([] (Factor *)), Num n) => Num (Qu d l n) | |
| Ord n => Ord (Qu d l n) | |
| ((~) [Factor *] d ([] (Factor *)), Real n) => Real (Qu d l n) | |
| ((~) [Factor *] d ([] (Factor *)), RealFloat n) => RealFloat (Qu d l n) | |
| ((~) [Factor *] d ([] (Factor *)), RealFrac n) => RealFrac (Qu d l n) | |
| (ShowUnitFactor (LookupList dims lcsu), Show n) => Show (Qu dims lcsu n) | |
| VectorSpace n => VectorSpace (Qu d l n) | |
| AdditiveGroup n => AdditiveGroup (Qu d l n) | |
| ValidDL d l => Quantity (Qu d l n) | |
| type Scalar (Qu d l n) = Scalar n | |
| type QuantityUnit (Qu d l n) = UnitOfDimFactors d l | |
| type QuantityLCSU (Qu d l n) = l | |
| type QuantityRep (Qu d l n) = n | |
| type (Qu d l n) %^ z = Qu ((@*) d z) l n | |
| type (Qu d1 l n) %/ (Qu d2 l n) = Qu ((@-) d1 d2) l n | |
| type (Qu d1 l n) %* (Qu d2 l n) = Qu ((@+) d1 d2) l n |