packages feed

units-defs 1.0 → 1.0.1

raw patch · 3 files changed

+66/−4 lines, 3 files

Files

CHANGES.md view
@@ -1,3 +1,9 @@+Version 1.0.1+-------------++ * Added derived SI units.+ * Added British-spelled synonyms for SI units.+ Version 1.0 ----------- 
Data/Metrology/SI/Units.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeFamilies, TypeOperators #-}+{-# LANGUAGE TypeFamilies, TypeOperators, PatternSynonyms #-}  ----------------------------------------------------------------------------- -- |@@ -12,15 +12,24 @@ -- This module exports unit definitions according to the SI system of units. -- The definitions were taken from here: <http://www.bipm.org/en/si/>. --+-- Some additional units were added base on+-- <http://www.bipm.org/en/si/si_brochure/chapter4/table6.html this link>:+-- "Non-SI units accepted for use with the SI,+-- and units based on fundamental constants".+-- -- There is one deviation from the definition at that site: To work better -- with prefixes, the unit of mass is 'Gram'.+--+-- This module exports both American spellings and British spellings of+-- units, using pattern synonyms to get the British spellings of data+-- constructors. -----------------------------------------------------------------------------  module Data.Metrology.SI.Units where  import Data.Metrology import Data.Metrology.SI.Dims-import Data.Metrology.SI.Prefixes ( Centi )+import Data.Metrology.SI.Prefixes ( Kilo, Centi )  data Meter = Meter instance Unit Meter where@@ -29,6 +38,9 @@ instance Show Meter where   show _ = "m" +type Metre = Meter+pattern Metre = Meter+ data Gram = Gram instance Unit Gram where   type BaseUnit Gram = Canonical@@ -43,6 +55,29 @@ instance Show Second where   show _ = "s" +-- | Derived SI unit+data Minute = Minute+instance Unit Minute where+  type BaseUnit Minute = Second+  conversionRatio _ = 60+instance Show Minute where+  show _ = "min"++-- | Derived SI unit+data Hour = Hour+instance Unit Hour where+  type BaseUnit Hour = Minute+  conversionRatio _ = 60+instance Show Hour where+  show _ = "h"++data Day = Day+instance Unit Day where+  type BaseUnit Day = Hour+  conversionRatio _ = 24+instance Show Day where+  show _ = "d"+ data Ampere = Ampere instance Unit Ampere where   type BaseUnit Ampere = Canonical@@ -85,6 +120,9 @@ instance Show Liter where   show _ = "l" +type Litre = Liter+pattern Litre = Liter+ data Newton = Newton instance Unit Newton where   type BaseUnit Newton = Gram :* Meter :/ (Second :^ Two)@@ -194,3 +232,21 @@ instance Show Katal where   show _ = "kat" +-- | Derived SI unit+data Hectare = Hectare+instance Unit Hectare where+  type BaseUnit Hectare = Meter :^ Two+  conversionRatio _ = 10000+instance Show Hectare where+  show _ = "ha"++-- | Derived SI unit+data Ton = Ton+instance Unit Ton where+  type BaseUnit Ton = Kilo :@ Gram+  conversionRatio _ = 1000+instance Show Ton where+  show _ = "t"++type Tonne = Ton+pattern Tonne = Ton
units-defs.cabal view
@@ -1,5 +1,5 @@ name:           units-defs-version:        1.0+version:        1.0.1 cabal-version:  >= 1.10 synopsis:       Definitions for use with the units package homepage:       http://github.com/goldfirere/units-defs@@ -23,7 +23,7 @@ source-repository this   type:     git   location: https://github.com/goldfirere/units-defs.git-  tag:      v1.0+  tag:      v1.0.1  library   build-depends: