units-2.4: 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) 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 

UnsafeQu

newtype UnsafeQu d l n Source

A basic wrapper around Qu that has more instances.

Constructors

UnsafeQu 

Fields

qu :: Qu d l n