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 |
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.
Qu n |
Eq n => Eq (Qu d l n) Source | |
((~) [Factor *] d ([] (Factor *)), Floating n) => Floating (Qu d l n) Source | |
((~) [Factor *] d ([] (Factor *)), Fractional n) => Fractional (Qu d l n) Source | |
((~) [Factor *] d ([] (Factor *)), Num n) => Num (Qu d l n) Source | |
Ord n => Ord (Qu d l n) Source | |
Read n => Read (Qu ([] (Factor *)) l n) Source | |
((~) [Factor *] d ([] (Factor *)), Real n) => Real (Qu d l n) Source | |
((~) [Factor *] d ([] (Factor *)), RealFloat n) => RealFloat (Qu d l n) Source | |
((~) [Factor *] d ([] (Factor *)), RealFrac n) => RealFrac (Qu d l n) Source | |
Show n => Show (Qu ([] (Factor *)) l n) Source | |
NFData n => NFData (Qu d l n) Source | |
VectorSpace n => VectorSpace (Qu d l n) Source | |
AdditiveGroup n => AdditiveGroup (Qu d l n) Source | |
ValidDL d l => Quantity (Qu d l n) Source | |
type Scalar (Qu d l n) = Scalar n Source | |
type QuantityUnit (Qu d l n) = UnitOfDimFactors d l Source | |
type QuantityLCSU (Qu d l n) = l Source | |
type QuantityRep (Qu d l n) = n Source | |
type (Qu d l n) %^ z = Qu ((@*) d z) l n Source | |
type (Qu d1 l n) %/ (Qu d2 l n) = Qu ((@-) d1 d2) l n Source | |
type (Qu d1 l n) %* (Qu d2 l n) = Qu ((@+) d1 d2) l n Source |