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

Copyright(C) 2013 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (eir@cis.upenn.edu)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellUnsafe
LanguageHaskell2010

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.

Synopsis

The Qu type

newtype Qu a lcsu n Source

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 

UnsafeQu

newtype UnsafeQu d l n Source

A basic wrapper around Qu that has more instances.

Constructors

UnsafeQu 

Fields

qu :: Qu d l n