packages feed

science-constants-dimensional (empty) → 0.1.0.0

raw patch · 5 files changed

+256/−0 lines, 5 filesdep +basedep +dimensionaldep +numtypesetup-changed

Dependencies added: base, dimensional, numtype, science-constants

Files

+ LICENSE view
@@ -0,0 +1,27 @@+Copyright (c) 2014  Anton Vorontsov <anton@enomsg.org>++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the distribution.+3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ science-constants-dimensional.cabal view
@@ -0,0 +1,59 @@+name: science-constants-dimensional+version: 0.1.0.0+license: BSD3+license-File: LICENSE+author: Anton Vorontsov <anton@enomsg.org>+maintainer: Anton Vorontsov <anton@enomsg.org>+category: Science, Math, Physics, Chemistry+synopsis: Mathematical/physical/chemical constants+description:+    "Science.Constants.Dimensional" is a variant of "Science.Constants"[1]+    package, with the only difference is that that the dimensional flavor+    provides (where applicable) dimensionally-typed constants. The+    "Numeric.Units.Dimensional"[2] wrappers allow to write type-safe+    formulas, for example all of this will successfully type-check:+    .+    > ~$ ghci -XNoImplicitPrelude+    > λ= import Numeric.Units.Dimensional.Prelude+    >+    > λ= import Science.Constants.Dimensional+    >+    > λ= massOfProton + massOfElectron+    >+    > 1.673532715291e-27 kg+    > λ= massOfProton / massOfElectron+    >+    > 1836.1526719486646+    .+    But this will not:+    .+    > λ= massOfProton / massOfElectron + planckConstant+    >+    > <interactive>:10:14:+    >     Couldn't match type `Numeric.NumType.Pos+    >                            (Numeric.NumType.Pos Numeric.NumType.Zero)'+    >                   with `Numeric.NumType.Zero'+    .+    [1] <https://hackage.haskell.org/package/science-constants>+    .+    [2] <https://hackage.haskell.org/package/dimensional>++build-type: Simple+cabal-version: >=1.10++source-repository head+    type: darcs+    location: http://code.haskell.org/science-constants-dimensional++library+    ghc-options: -Wall+    default-language: Haskell2010+    build-depends:+        base >=4.6 && <4.7+      , science-constants >= 0.2+      , numtype+      , dimensional+    hs-source-dirs: src+    exposed-modules:+      Science.Constants.Dimensional+      Science.Constants.Dimensional.Short
+ src/Science/Constants/Dimensional.hs view
@@ -0,0 +1,109 @@+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}++-----------------------------------------------------------------------------+-- |+-- Module      :  Science.Constants.Dimensional+-- Copyright   :  (c) Anton Vorontsov <anton@enomsg.org>+-- License     :  BSD3+--+-- Maintainer  :  Anton Vorontsov <anton@enomsg.org>+-- Stability   :  provisional+-- Portability :  portable+--+-- Dimensional Scientific Constants+--+-----------------------------------------------------------------------------++module Science.Constants.Dimensional where++import qualified Prelude+import qualified Science.Constants as C+import Science.Constants.Dimensional.Private+import Numeric.NumType (neg1,neg2,neg3,pos2,pos3,pos4)+import Numeric.Units.Dimensional+import Numeric.Units.Dimensional.SIUnits+import Numeric.Units.Dimensional.Quantities++planckConstant  = C.planckConstant+    *~ (square meter * kilo gram / second)+    ~~ joule * second+plancksConstant = planckConstant++reducedPlanckConstant  = C.reducedPlanckConstant+    *~ (square meter * kilo gram / second)+    ~~ joule * second+reducedPlancksConstant = reducedPlanckConstant+planckConstantOver2Pi  = reducedPlanckConstant+plancksConstantOver2Pi = reducedPlanckConstant+hbar                   = reducedPlanckConstant+hslash                 = reducedPlanckConstant++speedOfLight = C.speedOfLight *~ (meter / second)++vacuumPermeability      = C.vacuumPermeability+    *~ (kilo gram * meter * second^neg2 * ampere^neg2)+    ~~ newton * ampere^neg2+permeabilityOfFreeSpace = vacuumPermeability+magneticConstant        = vacuumPermeability+mu_0                    = vacuumPermeability++vacuumPermittivity = C.vacuumPermittivity+    *~ (ampere^pos2 * second^pos4 * kilo gram^neg1 * meter^neg3)+    ~~ farad * meter^neg1+    ~~ coulomb^pos2 * newton^neg1 * meter^neg2+electricConstant   = vacuumPermittivity+eps_0              = vacuumPermittivity++coulombsConstant      = C.coulombsConstant+    *~ (kilo gram * meter^pos3 * coulomb^neg2 * second^neg2)+    ~~ meter / farad+    ~~ newton * meter^pos2 * coulomb^neg2+coulombConstant       = coulombsConstant+electricForceConstant = coulombsConstant+electrostaticConstant = coulombsConstant++rydbergConstant  = C.rydbergConstant *~ (meter^neg1)+rydbergsConstant = rydbergConstant++avogadroConstant = C.avogadroConstant *~ (mole^neg1)++boltzmannConstant  = C.boltzmannConstant+    *~ (meter^pos2 * kilo gram * second^neg2 * kelvin^neg1)+    ~~ joule / kelvin+boltzmannsConstant = boltzmannConstant++molarGasConstant     = C.molarGasConstant+    *~ (meter^pos2 * kilo gram * second^neg2 * kelvin^neg1 * mole^neg1)+    ~~ joule * mole^neg1 * kelvin^neg1+idealGasConstant     = molarGasConstant+universalGasConstant = molarGasConstant++molarMassConstant     = C.molarMassConstant *~ (kilo gram / mole)++gravitationalConstant = C.gravitationalConstant+    *~ (kilo gram^neg1 * meter^pos3 * second^neg2)+    ~~ newton * meter^pos2 * kilo gram^neg2+newtonConstant        = gravitationalConstant+newtonsConstant       = gravitationalConstant+bigG                  = gravitationalConstant++standardAccelerationOfGravity = C.standardAccelerationOfGravity+    *~ (meter * second^neg2)+earthAccelerationOfGravity    = standardAccelerationOfGravity++atomicMassConstant = C.atomicMassConstant *~ (kilo gram)+atomicMassUnit     = atomicMassConstant+dalton             = atomicMassConstant++electronMolarMass   = C.electronMolarMass+    *~ (kilo gram / mole)+molarMassOfElectron = electronMolarMass++massOfElectron = C.massOfElectron *~ kilo gram++massOfProton = C.massOfProton *~ kilo gram++elementaryCharge = C.elementaryCharge *~ coulomb+chargeOfProton   = elementaryCharge++chargeOfElectron = (-C.elementaryCharge) *~ coulomb
+ src/Science/Constants/Dimensional/Short.hs view
@@ -0,0 +1,59 @@+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}++-----------------------------------------------------------------------------+-- |+-- Module      :  Science.Constants.Dimensional.Short+-- Copyright   :  (c) Anton Vorontsov <anton@enomsg.org>+-- License     :  BSD3+--+-- Maintainer  :  Anton Vorontsov <anton@enomsg.org>+-- Stability   :  provisional+-- Portability :  portable+--+-- Short Names for Scientific Constants+--+-----------------------------------------------------------------------------++module Science.Constants.Dimensional.Short where++import qualified Prelude+import qualified Science.Constants.Short as C+import Science.Constants.Dimensional+import Numeric.Units.Dimensional+import Numeric.Units.Dimensional.SIUnits++-- | Planck Constant+h   = planckConstant++-- | Reduced Planck Constant+_h  = reducedPlanckConstant++-- | Vacuum Permittivity+e_0 = vacuumPermittivity++-- | Coulomb's Constant+k_e = coulombsConstant++-- | Boltzmann Constant+k_b = boltzmannConstant++-- | Standard Acceleration of Gravity (9.8...)+g   = standardAccelerationOfGravity++-- | Atomic Mass Constant+amu = atomicMassConstant++-- | Mass of an Electron at Rest+m_e = massOfElectron++-- | Mass of a Proton+m_p = massOfProton++-- | Charge of a Proton+q_p = chargeOfProton++-- | Charge of an Electron+q_e = chargeOfElectron++-- | Tau (2*pi)+tau = C.tau *~ radian