uom-plugin 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+18/−2 lines, 3 filesdep +deepseq
Dependencies added: deepseq
Files
- src/Data/UnitsOfMeasure/Defs.hs +9/−1
- src/Data/UnitsOfMeasure/Internal.hs +7/−0
- uom-plugin.cabal +2/−1
src/Data/UnitsOfMeasure/Defs.hs view
@@ -38,7 +38,15 @@ -- Non-SI units accepted for use with them -- http://www.bipm.org/en/publications/si-brochure/chapter4.html-[u| min = 60 s, h = 3600 s, d, ha, l, t, au |]+-- hectares and liters are unable to be defined at the moment due to+-- https://github.com/adamgundry/uom-plugin/issues/4+[u| min = 60 s+ , h = 3600 s+ , d = 86400 s+ , ha+ , l+ , t = 1000 kg+ , au = 149597870700 m |] -- Some random other units [u| ft = 100 % 328 m, in = 0.0254 m, mi = 1609.344 m, mph = mi/h |]
src/Data/UnitsOfMeasure/Internal.hs view
@@ -56,6 +56,8 @@ , MkUnit ) where +import Control.DeepSeq+import Foreign.Storable import GHC.Exts (Constraint) import GHC.TypeLits (Symbol, Nat, type (-)) @@ -121,6 +123,11 @@ deriving instance (RealFloat a, u ~ One) => RealFloat (Quantity a u) deriving instance (RealFrac a, u ~ One) => RealFrac (Quantity a u) +-- To enable marshalling into FFI code.+deriving instance Storable a => Storable (Quantity a u)++-- To enable deriving NFData for data types containing Quantity fields.+deriving instance NFData a => NFData (Quantity a u) -- | Extract the underlying value of a quantity unQuantity :: Quantity a u -> a
uom-plugin.cabal view
@@ -1,5 +1,5 @@ name: uom-plugin-version: 0.1.0.0+version: 0.1.1.0 synopsis: Units of measure as a GHC typechecker plugin category: Type System description: A prototype typechecker plugin for GHC with support for units of measure@@ -40,6 +40,7 @@ TcPluginExtras other-extensions: TemplateHaskell build-depends: base >=4.7 && <5,+ deepseq >=1.3 && <1.5, ghc >= 7.9 && <7.12, ghc-tcplugins-extra >=0.1 && <0.2, template-haskell >=2.9 && <2.12,