dimensional-tf 0.2 → 0.2.1
raw patch · 6 files changed
+65/−25 lines, 6 files
Files
- LICENSE +1/−1
- Numeric/Units/Dimensional/TF.lhs +14/−5
- Numeric/Units/Dimensional/TF/NonSI.lhs +18/−2
- Numeric/Units/Dimensional/TF/Quantities.lhs +10/−1
- Numeric/Units/Dimensional/TF/SIUnits.lhs +20/−12
- dimensional-tf.cabal +2/−4
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2006-2012, Bjorn Buckwalter.+Copyright (c) 2006-2013, Bjorn Buckwalter. All rights reserved. Redistribution and use in source and binary forms, with or without
Numeric/Units/Dimensional/TF.lhs view
@@ -55,7 +55,7 @@ > #-} > {- |-> Copyright : Copyright (C) 2006-2012 Bjorn Buckwalter+> Copyright : Copyright (C) 2006-2013 Bjorn Buckwalter > License : BSD3 > > Maintainer : bjorn.buckwalter@gmail.com@@ -435,10 +435,15 @@ > one :: Num a => Unit DOne a > one = Dimensional 1 -For convenience We define some constants for small integer values-that often show up in formulae. We also throw in 'pi' for good-measure.+For convenience we define some constants for small integer values+that often show up in formulae. We also throw in 'pi' and 'tau' for+good measure. +The constant for zero is polymorphic as proposed by Douglas McClean+(http://code.google.com/p/dimensional/issues/detail?id=39) allowing+it to express zero Length or Capacitance or Velocity etc, in addition+to the dimensionless value zero.+ > _0 :: (Num a) => Quantity d a > _0 = Dimensional 0 @@ -453,8 +458,12 @@ > _8 = 8 *~ one > _9 = 9 *~ one -> pi :: (Floating a) => Dimensionless a+For background on 'tau' see http://tauday.com/tau-manifesto (but also+feel free to review http://www.thepimanifesto.com).++> pi, tau :: (Floating a) => Dimensionless a > pi = Prelude.pi *~ one+> tau = _2 * pi = Instances of 'Show' =
Numeric/Units/Dimensional/TF/NonSI.lhs view
@@ -13,7 +13,7 @@ otherwise specified. > {- |-> Copyright : Copyright (C) 2006-2012 Bjorn Buckwalter+> Copyright : Copyright (C) 2006-2013 Bjorn Buckwalter > License : BSD3 > > Maintainer : bjorn.buckwalter@gmail.com@@ -72,9 +72,10 @@ > inch, foot :: Fractional a => Unit DLength a > inch = prefix 2.54 (centi meter) > foot = prefix 12 inch -- 0.3048 m+> mil = prefix 0.001 inch > poundMass, ounce :: Fractional a => Unit DMass a > poundMass = prefix 0.45359237 (kilo gram)-> ounce = prefix 28.349523 gram+> ounce = prefix (1 Prelude./ 16) poundMass > poundForce :: Fractional a => Unit DForce a > poundForce = poundMass * gee -- 4.4482 N@@ -168,6 +169,21 @@ > stokes :: (Fractional a) => Unit DKinematicViscosity a > stokes = centi meter ^ pos2 / second+++= Imperial Volumes =++Per http://en.wikipedia.org/wiki/Imperial_units.++> imperialGallon, imperialQuart, imperialPint, imperialCup,+> imperialGill, imperialFluidOunce+> :: (Fractional a) => Unit DVolume a+> imperialGallon = prefix 4.54609 liter+> imperialQuart = prefix (1 Prelude./ 4) imperialGallon+> imperialPint = prefix (1 Prelude./ 8) imperialGallon+> imperialCup = prefix 0.5 imperialPint+> imperialGill = prefix (1 Prelude./ 4) imperialPint+> imperialFluidOunce = prefix (1 Prelude./ 20) imperialPint = References =
Numeric/Units/Dimensional/TF/Quantities.lhs view
@@ -16,7 +16,7 @@ dimensionality type synonyms are provided for each quantity type. > {- |-> Copyright : Copyright (C) 2006-2012 Bjorn Buckwalter+> Copyright : Copyright (C) 2006-2013 Bjorn Buckwalter > License : BSD3 > > Maintainer : bjorn.buckwalter@gmail.com@@ -304,6 +304,15 @@ > type DKinematicViscosity = Dim Pos2 Zero Neg1 Zero Zero Zero Zero > type KinematicViscosity = Quantity DKinematicViscosity++> type DFirstMassMoment = Dim Pos1 Pos1 Zero Zero Zero Zero Zero+> type FirstMassMoment = Quantity DFirstMassMoment++> type DMomentOfInertia = Dim Pos2 Pos1 Zero Zero Zero Zero Zero+> type MomentOfInertia = Quantity DMomentOfInertia++> type DAngularMomentum = Dim Pos2 Pos1 Neg1 Zero Zero Zero Zero+> type AngularMomentum = Quantity DAngularMomentum For these we don't bother defining new type synonyms for dimensionalities. Is this rational?
Numeric/Units/Dimensional/TF/SIUnits.lhs view
@@ -11,7 +11,7 @@ referenced are from [1] unless otherwise specified. > {- |-> Copyright : Copyright (C) 2006-2012 Bjorn Buckwalter+> Copyright : Copyright (C) 2006-2013 Bjorn Buckwalter > License : BSD3 > > Maintainer : bjorn.buckwalter@gmail.com@@ -45,8 +45,8 @@ > :: Num a => Unit d a -> Unit d a > deka = prefix 10 -- International English. > deca = deka -- American English.-> hecto = deka . deka-> kilo = deka . hecto+> hecto = prefix 100+> kilo = prefix 1000 > mega = kilo . kilo > giga = kilo . mega > tera = kilo . giga@@ -60,15 +60,15 @@ > deci, centi, milli, micro, nano, pico, femto, atto, zepto, yocto > :: Fractional a => Unit d a -> Unit d a > deci = prefix 0.1-> centi = deci . deci-> milli = deci . centi-> micro = milli . milli-> nano = milli . micro-> pico = milli . nano-> femto = milli . pico-> atto = milli . femto-> zepto = milli . atto-> yocto = milli . zepto+> centi = prefix 0.01+> milli = prefix 1e-3+> micro = prefix 1e-6+> nano = prefix 1e-9+> pico = prefix 1e-12+> femto = prefix 1e-15+> atto = prefix 1e-18+> zepto = prefix 1e-21+> yocto = prefix 1e-24 By defining SI prefixes as functions applied to a 'Unit' we satisfy section 6.2.6 "Unacceptability of stand-alone prefixes".@@ -262,9 +262,17 @@ > tonne = prefix 1000 (kilo gram) -- Name in original SI text. > metricTon = tonne -- American name. +In 2012 the IAU redefined the astronomical unit as a conventional+unit of length directly tied to the meter, with a length of exactly+149,597,870,700 m and the official abbreviation of au[3]. +> astronomicalUnit :: Num a => Unit DLength a+> astronomicalUnit = prefix 149597870700 meter++ = References = [1] http://physics.nist.gov/Pubs/SP811/ [2] http://en.wikipedia.org/wiki/Minute_of_arc+[3] http://en.wikipedia.org/wiki/Astronomical_unit
dimensional-tf.cabal view
@@ -1,8 +1,8 @@ Name: dimensional-tf-Version: 0.2+Version: 0.2.1 License: BSD3 License-File: LICENSE-Copyright: Bjorn Buckwalter 2006-2012+Copyright: Bjorn Buckwalter 2006-2013 Author: Bjorn Buckwalter Maintainer: bjorn.buckwalter@gmail.com Stability: experimental@@ -23,8 +23,6 @@ The dimensional-tf packade differs from the dimensional package in that the dimension tracking is implemented using type families rather than functional dependencies.-- Requires GHC 7.0 or later. Category: Math, Physics Build-Type: Simple