packages feed

dimensional 1.2 → 1.3

raw patch · 11 files changed

+181/−189 lines, 11 filesdep ~basedep ~exact-piPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, exact-pi

API changes (from Hackage documentation)

+ Numeric.Units.Dimensional: expm1 :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional: log1mexp :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional: log1p :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional: log1pexp :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional.NonSI: percent :: Fractional a => Unit 'NonMetric DOne a
+ Numeric.Units.Dimensional.Prelude: expm1 :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional.Prelude: log1mexp :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional.Prelude: log1p :: Floating a => Dimensionless a -> Dimensionless a
+ Numeric.Units.Dimensional.Prelude: log1pexp :: Floating a => Dimensionless a -> Dimensionless a

Files

CHANGELOG.md view
@@ -1,3 +1,11 @@+1.3 (2018-12)+-------------+* Breaking: Changed the `Show` instances for `UnitName`, `Unit`, `SQuantity` to use non-breaking spaces+  within unit names and between values and their units.+* Bumped exact-pi dependency to < 0.6.+* Added the dimensionless unit `percent`.+* Added dimensionless wrappers for `log1p`, `expm1`, `log1pexp`, and `log1mexp` from the `Floating` class.+ 1.2 (2018-11) ------------- * Add `NoStarIsType` extension and import `Data.Kind.Type` for [GHC 8.6 compitbility](https://github.com/ghc-proposals/ghc-proposals/blob/05721788de9ab6538def68c3c2c9dec50c9f24a8/proposals/0020-no-type-in-type.rst). Abandon compatibility with GHC < 8.
dimensional.cabal view
@@ -1,5 +1,5 @@ name:                dimensional-version:             1.2+version:             1.3 license:             BSD3 license-file:        LICENSE copyright:           Bjorn Buckwalter 2006-2018@@ -44,7 +44,7 @@ library   build-depends:       base >= 4.7 && < 5,                        deepseq >= 1.3,-                       exact-pi >= 0.4.1 && < 0.5,+                       exact-pi >= 0.4.1 && < 0.6,                        ieee754 >= 0.7.6,                        numtype-dk >= 0.5 && < 1.1,                        vector >= 0.10,
src/Numeric/Units/Dimensional.hs view
@@ -2,7 +2,6 @@ 
 {-# LANGUAGE AutoDeriveTypeable #-}
 {-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE CPP #-}
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE DeriveGeneric #-}
@@ -59,7 +58,7 @@ 
 == Preliminaries
 
-This module requires GHC 7.8 or later. We utilize Data Kinds, TypeNats,
+This module requires GHC 8 or later. We utilize Data Kinds, TypeNats,
 Closed Type Families, etc. Clients of the module are generally not
 required to use these extensions.
 
@@ -188,7 +187,7 @@     (^), (^/), (**), (*), (/), (+), (-),
     negate, abs, signum, recip, nroot, sqrt, cbrt,
     -- ** Transcendental Functions
-    exp, log, logBase, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, atan2,
+    exp, log, logBase, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, atan2, log1p, expm1, log1pexp, log1mexp,
     -- ** Operations on Collections
     -- $collections
     (*~~), (/~~), sum, mean, product, dimensionlessLength, nFromTo,
@@ -228,9 +227,10 @@   )
 import Data.Data
 import Data.ExactPi
-import Data.Foldable (Foldable(foldr))
+import Data.Foldable (Foldable(foldr, length))
 import Data.Maybe
 import Data.Ratio
+import qualified Numeric
 import Numeric.Units.Dimensional.Dimensions
 import Numeric.Units.Dimensional.Internal
 import Numeric.Units.Dimensional.UnitNames hiding ((*), (/), (^), weaken, strengthen, product)
@@ -238,18 +238,6 @@ import Numeric.Units.Dimensional.Variants hiding (type (*), type (/))
 import qualified Numeric.Units.Dimensional.Variants as V
 
--- Provide a version of length which is compatible with base-4.8's version.
--- Where 4.8 is available we use that version as it may have performance advantages.
--- Where it is not available we implement it in terms of foldl'.
-#if MIN_VERSION_base(4,8,0)
-import Data.Foldable (Foldable(length))
-#else
-import Data.Foldable (Foldable(foldl'))
-
-length :: Foldable t => t a -> Int
-length = foldl' (\c _ -> c Prelude.+ 1) 0
-#endif
-
 -- $setup
 -- >>> :set -XFlexibleInstances
 -- >>> :set -XNoImplicitPrelude
@@ -411,7 +399,7 @@ -- | Forms the reciprocal of a 'Quantity', which has the reciprocal dimension.
 --
 -- >>> recip $ 47 *~ hertz
--- 2.127659574468085e-2 s
+-- 2.127659574468085e-2 s
 recip :: (Fractional a) => Quantity d a -> Quantity (Recip d) a
 recip = liftQ Prelude.recip
 
@@ -550,10 +538,10 @@ -- | The sum of all elements in a foldable structure.
 --
 -- >>> sum ([] :: [Mass Double])
--- 0.0 kg
+-- 0.0 kg
 --
 -- >>> sum [12.4 *~ meter, 1 *~ foot]
--- 12.7048 m
+-- 12.7048 m
 sum :: (Num a, Foldable f) => f (Quantity d a) -> Quantity d a
 sum = foldr (+) _0
 
@@ -612,7 +600,7 @@ that may be obviously useful.
 -}
 
-exp, log, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh
+exp, log, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, log1p, expm1, log1pexp, log1mexp
   :: Floating a => Dimensionless a -> Dimensionless a
 exp   = fmap Prelude.exp
 log   = fmap Prelude.log
@@ -628,6 +616,10 @@ asinh = fmap Prelude.asinh
 acosh = fmap Prelude.acosh
 atanh = fmap Prelude.atanh
+log1p = fmap Numeric.log1p
+expm1 = fmap Numeric.expm1
+log1pexp = fmap Numeric.log1pexp
+log1mexp = fmap Numeric.log1mexp
 
 -- | Raises a dimensionless quantity to a dimensionless power.
 (**) :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a
@@ -716,7 +708,7 @@ --
 -- >>> let x = (37 :: Rational) *~ poundMass
 -- >>> changeRep x :: Mass Double
--- 16.78291769 kg
+-- 16.78291769 kg
 changeRep :: (KnownVariant v, Real a, Fractional b) => Dimensional v d a -> Dimensional v d b
 changeRep = dmap realToFrac
 
src/Numeric/Units/Dimensional/Dynamic.hs view
@@ -88,7 +88,7 @@ 
 instance (Show a) => Show (AnyQuantity a) where
   show (AnyQuantity d a) | d == D.dOne = show a
-                         | otherwise   = (show a) ++ " " ++ (show . baseUnitName $ d)
+                         | otherwise   = show a ++ " " ++ (show . baseUnitName $ d)
 
 instance HasDynamicDimension (AnyQuantity a) where
 
@@ -212,7 +212,7 @@ 
 -- Lifts a function which is only valid on dimensionless quantities into a function on DynQuantitys.
 liftDimensionless :: (a -> a) -> DynQuantity a -> DynQuantity a
-liftDimensionless f = liftDQ (matchDimensions $ SomeDimension D.dOne) f
+liftDimensionless = liftDQ (matchDimensions $ SomeDimension D.dOne)
 
 -- Lifts a function on values into a function on DynQuantitys.
 liftDQ :: (DynamicDimension -> DynamicDimension) -- ^ How the function operates on dimensions.
@@ -265,7 +265,7 @@   deriving (Generic, Typeable)
 
 instance Show AnyUnit where
-  show (AnyUnit _ n e) = (show n) ++ " =def= " ++ (show e) ++ " of the SI base unit"
+  show (AnyUnit _ n e) = show n ++ " =def= " ++ show e ++ " of the SI base unit"
 
 instance HasDynamicDimension AnyUnit where
 
src/Numeric/Units/Dimensional/Float.hs view
@@ -104,25 +104,25 @@ --
 -- >>> let x = 3 *~ meter
 -- >>> scaleFloat 3 x
--- 24.0 m
+-- 24.0 m
 scaleFloat :: RealFloat a => Int -> Quantity d a -> Quantity d a
 scaleFloat x = Quantity . P.scaleFloat x . unQuantity
 
 -- | An infinite floating-point quantity.
 infinity :: IEEE a => Quantity d a
-infinity = Quantity $ F.infinity
+infinity = Quantity F.infinity
 
 -- | The smallest representable positive quantity whose representation is normalized.
 minNormal :: IEEE a => Quantity d a
-minNormal = Quantity $ F.minNormal
+minNormal = Quantity F.minNormal
 
 -- | The largest representable finite floating-point quantity.
 maxFinite :: IEEE a => Quantity d a
-maxFinite = Quantity $ F.maxFinite
+maxFinite = Quantity F.maxFinite
 
 -- | The smallest positive value @x@ such that @_1 + x@ is representable.
 epsilon :: IEEE a => Dimensionless a
-epsilon = Quantity $ F.epsilon
+epsilon = Quantity F.epsilon
 
 -- | @copySign x y@ returns the quantity @x@ with its sign changed to match that of @y@.
 copySign :: IEEE a => Quantity d a -> Quantity d a -> Quantity d a
@@ -148,7 +148,7 @@ 
 -- | Default @NaN@ quantity.
 nan :: IEEE a => Quantity d a
-nan = Quantity $ F.nan
+nan = Quantity F.nan
 
 -- | Quiet @NaN@ quantity with a positive integer payload.
 -- Payload must be less than 'maxNaNPayload' of the representation type.
src/Numeric/Units/Dimensional/Functor.hs view
@@ -1,14 +1,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}
 {-# OPTIONS_HADDOCK show-extensions #-}
 
-{-# LANGUAGE CPP #-}
-#if MIN_VERSION_base(4,8,0)
--- OverlappingInstances was deprecated by GHC 7.10 in favor of OVERLAPPING pragmas.
-#else
-{-# LANGUAGE OverlappingInstances #-}
-{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-}
-#endif
-
 {- |
    Copyright  : Copyright (C) 2006-2018 Bjorn Buckwalter
    License    : BSD3
src/Numeric/Units/Dimensional/Internal.hs view
@@ -27,15 +27,12 @@ 
 import Control.Applicative
 import Control.DeepSeq
-import Control.Monad (liftM)
 import Data.AEq (AEq)
 import Data.Coerce (coerce)
 import Data.Data
 import Data.Kind
 import Data.ExactPi
-#if MIN_VERSION_base(4,9,0)
 import Data.Functor.Classes (Eq1(..), Ord1(..))
-#endif
 import qualified Data.ExactPi.TypeLevel as E
 import Data.Monoid (Monoid(..))
 import Data.Semigroup (Semigroup(..))
@@ -84,7 +81,7 @@   type ScaleFactor v :: E.ExactPi'
   extractValue :: Dimensional v d a -> (a, Maybe ExactPi)
   extractName :: Dimensional v d a -> Maybe (UnitName 'NonMetric)
-  injectValue :: (Maybe (UnitName 'NonMetric)) -> (a, Maybe ExactPi) -> Dimensional v d a
+  injectValue :: Maybe (UnitName 'NonMetric) -> (a, Maybe ExactPi) -> Dimensional v d a
   -- | Maps over the underlying representation of a dimensional value.
   -- The caller is responsible for ensuring that the supplied function respects the dimensional abstraction.
   -- This means that the function must preserve numerical values, or linearly scale them while preserving the origin.
@@ -94,11 +91,7 @@ 
 instance KnownVariant ('DQuantity s) where
   newtype Dimensional ('DQuantity s) d a = Quantity a
-    deriving (Eq, Ord, AEq, Data, Generic, Generic1
-#if MIN_VERSION_base(4,8,0)
-     , Typeable -- GHC 7.8 doesn't support deriving this instance
-#endif
-    )
+    deriving (Eq, Ord, AEq, Data, Generic, Generic1, Typeable)
   type (ScaleFactor ('DQuantity s)) = s
   extractValue (Quantity x) = (x, Nothing)
   extractName _ = Nothing
@@ -107,11 +100,7 @@ 
 instance (Typeable m) => KnownVariant ('DUnit m) where
   data Dimensional ('DUnit m) d a = Unit !(UnitName m) !ExactPi !a
-    deriving (Generic, Generic1
-#if MIN_VERSION_base(4,8,0)
-     , Typeable -- GHC 7.8 doesn't support deriving this instance
-#endif
-    )
+    deriving (Generic, Generic1, Typeable)
   type (ScaleFactor ('DUnit m)) = E.One
   extractValue (Unit _ e x) = (x, Just e)
   extractName (Unit n _ _) = Just . Name.weaken $ n
@@ -125,13 +114,11 @@   minBound = Quantity minBound
   maxBound = Quantity maxBound
 
-#if MIN_VERSION_base(4,9,0)
 instance Eq1 (SQuantity s d) where
   liftEq = coerce
 
 instance Ord1 (SQuantity s d) where
   liftCompare = coerce
-#endif
 
 instance HasInterchangeName (Unit m d a) where
   interchangeName (Unit n _ _) = interchangeName n
@@ -182,7 +169,7 @@   {-# INLINE alignment #-}
   poke ptr = poke (castPtr ptr :: Ptr a) . coerce
   {-# INLINE poke #-}
-  peek ptr = liftM Quantity (peek (castPtr ptr :: Ptr a))
+  peek ptr = fmap Quantity (peek (castPtr ptr :: Ptr a))
   {-# INLINE peek #-}
 
 {-
@@ -199,9 +186,9 @@   {-# INLINE basicUnsafeSlice #-}
   basicOverlaps u v    = M.basicOverlaps (unMVQ u) (unMVQ v)
   {-# INLINE basicOverlaps #-}
-  basicUnsafeNew       = liftM MV_Quantity . M.basicUnsafeNew
+  basicUnsafeNew       = fmap MV_Quantity . M.basicUnsafeNew
   {-# INLINE basicUnsafeNew #-}
-  basicUnsafeRead v    = liftM Quantity . M.basicUnsafeRead (unMVQ v)
+  basicUnsafeRead v    = fmap Quantity . M.basicUnsafeRead (unMVQ v)
   {-# INLINE basicUnsafeRead #-}
   basicUnsafeWrite v i = M.basicUnsafeWrite (unMVQ v) i . coerce
   {-# INLINE basicUnsafeWrite #-}
@@ -211,15 +198,15 @@ #endif
 
 instance (G.Vector U.Vector a) => G.Vector U.Vector (SQuantity s d a) where
-  basicUnsafeFreeze    = liftM V_Quantity  . G.basicUnsafeFreeze . unMVQ
+  basicUnsafeFreeze    = fmap V_Quantity  . G.basicUnsafeFreeze . unMVQ
   {-# INLINE basicUnsafeFreeze #-}
-  basicUnsafeThaw      = liftM MV_Quantity . G.basicUnsafeThaw   . unVQ
+  basicUnsafeThaw      = fmap MV_Quantity . G.basicUnsafeThaw   . unVQ
   {-# INLINE basicUnsafeThaw #-}
   basicLength          = G.basicLength . unVQ
   {-# INLINE basicLength #-}
   basicUnsafeSlice m n = V_Quantity . G.basicUnsafeSlice m n . unVQ
   {-# INLINE basicUnsafeSlice #-}
-  basicUnsafeIndexM v  = liftM Quantity . G.basicUnsafeIndexM (unVQ v)
+  basicUnsafeIndexM v  = fmap Quantity . G.basicUnsafeIndexM (unVQ v)
   {-# INLINE basicUnsafeIndexM #-}
 
 {-
@@ -227,6 +214,7 @@ quantities. The SI unit of the quantity is inferred
 from its dimension.
 -}
+-- | Uses non-breaking spaces between the value and the unit, and within the unit name.
 instance (KnownDimension d, E.KnownExactPi s, Show a, Real a) => Show (SQuantity s d a) where
   show (Quantity x) | isExactOne s' = show x ++ showName n
                     | otherwise = "Quantity " ++ show x ++ " {- " ++ show q ++ " -}"
@@ -238,23 +226,26 @@ 
 -- | Shows the value of a 'Quantity' expressed in a specified 'Unit' of the same 'Dimension'.
 --
--- >>> showIn watt $ (37 *~ volt) * (4 *~ ampere)
--- "148.0 W"
+-- Uses non-breaking spaces between the value and the unit, and within the unit name.
+--
+-- >>> putStrLn $ showIn watt $ (37 *~ volt) * (4 *~ ampere)
+-- 148.0 W
 showIn :: (Show a, Fractional a) => Unit m d a -> Quantity d a -> String
 showIn (Unit n _ y) (Quantity x) = show (x / y) ++ (showName . Name.weaken $ n)
 
 showName :: UnitName 'NonMetric -> String
 showName n | n == nOne = ""
-           | otherwise = " " ++ show n
+           | otherwise = "\xA0" ++ show n
 
+-- | Unit names are shown with non-breaking spaces.
 instance (Show a) => Show (Unit m d a) where
   show (Unit n e x) = "The unit " ++ show n ++ ", with value " ++ show e ++ " (or " ++ show x ++ ")"
 
 -- Operates on a dimensional value using a unary operation on values, possibly yielding a Unit.
-liftD :: (KnownVariant v1, KnownVariant v2) => (ExactPi -> ExactPi) -> (a -> b) -> UnitNameTransformer -> (Dimensional v1 d1 a) -> (Dimensional v2 d2 b)
+liftD :: (KnownVariant v1, KnownVariant v2) => (ExactPi -> ExactPi) -> (a -> b) -> UnitNameTransformer -> Dimensional v1 d1 a -> Dimensional v2 d2 b
 liftD fe f nt x = let (x', e') = extractValue x
                       n = extractName x
-                      n' = (liftA nt) n
+                      n' = fmap nt n
                    in injectValue n' (f x', fmap fe e')
 
 -- Operates on a dimensional value using a unary operation on values, yielding a Quantity.
@@ -267,7 +258,7 @@                            (x2', e2') = extractValue x2
                            n1 = extractName x1
                            n2 = extractName x2
-                           n' = (liftA2 nt) n1 n2
+                           n' = liftA2 nt n1 n2
                         in injectValue n' (f x1' x2', fe <$> e1' <*> e2')
 
 -- Combines two dimensional values using a binary operation on values, yielding a Quantity.
src/Numeric/Units/Dimensional/NonSI.hs view
@@ -39,6 +39,8 @@   -- * Units Defined By Experiment
   -- $values-obtained-experimentally
   electronVolt, unifiedAtomicMassUnit, dalton,
+  -- * Dimensionless Units
+  percent,
   -- * Standard Gravity
   gee,
   -- * Inch-pound Units
@@ -112,6 +114,17 @@ dalton :: Floating a => Unit 'Metric DMass a
 dalton = mkUnitR (ucumMetric "u" "Da" "Dalton") 1 $ unifiedAtomicMassUnit
 
+-- | One percent is one hundrendth.
+--
+-- The dimensionless number 0.01 , represented by the symbol %, is commonly used as a dimensionless unit.
+--
+-- See section 7.10.2 of the <#note1 [1]> for further information.
+--
+-- >>> 1 *~ percent
+-- 1.0e-2
+percent :: (Fractional a) => Unit 'NonMetric DOne a
+percent = mkUnitQ (ucum "%" "%" "percent") (1 Prelude./ 100) one
+
 -- | One gee is the standard value of the acceleration due to gravity at the
 -- Earth's surface, as standardized by CIPM.
 --
@@ -121,10 +134,10 @@ -- See <https://en.wikipedia.org/wiki/Standard_gravity here> for further information.
 --
 -- >>> 1 *~ gee
--- 9.80665 m s^-2
+-- 9.80665 m s^-2
 --
 -- >>> 1 *~ gee :: Acceleration Rational
--- 196133 % 20000 m s^-2
+-- 196133 % 20000 m s^-2
 gee :: Fractional a => Unit 'Metric DAcceleration a
 gee = mkUnitQ (ucumMetric "[g]" "g" "gee") 9.80665 $ meter / second ^ pos2
 
@@ -137,12 +150,12 @@ -- See <https://en.wikipedia.org/wiki/Foot_%28unit%29#International_foot here> for further information.
 --
 -- >>> 1 *~ foot
--- 0.3048 m
+-- 0.3048 m
 --
 -- prop> 3 *~ foot === 1 *~ yard
 --
 -- >>> 1 *~ foot :: Length Rational
--- 381 % 1250 m
+-- 381 % 1250 m
 foot :: Fractional a => Unit 'NonMetric DLength a
 foot = mkUnitQ (ucum "[ft_i]" "ft" "foot") (1 Prelude./ 3) $ yard
 
@@ -153,12 +166,12 @@ -- See <https://en.wikipedia.org/wiki/Inch#Modern_standardisation here> for further information.
 --
 -- >>> 1 *~ inch
--- 2.54e-2 m
+-- 2.54e-2 m
 --
 -- prop> 12 *~ inch === 1 *~ foot
 --
 -- >>> 1 *~ inch :: Length Rational
--- 127 % 5000 m
+-- 127 % 5000 m
 inch :: Fractional a => Unit 'NonMetric DLength a
 inch = mkUnitQ (ucum "[in_i]" "in" "inch") (1 Prelude./ 12) $ foot
 
@@ -169,12 +182,12 @@ -- See <https://en.wikipedia.org/wiki/Thousandth_of_an_inch here> for further information.
 --
 -- >>> 1 *~ mil
--- 2.54e-5 m
+-- 2.54e-5 m
 --
 -- prop> 1000 *~ mil === 1 *~ inch
 --
 -- >>> 1 *~ mil :: Length Rational
--- 127 % 5000000 m
+-- 127 % 5000000 m
 mil :: Fractional a => Unit 'NonMetric DLength a
 mil = mkUnitQ (ucum "[mil_i]" "mil" "mil") 0.001 $ inch
 
@@ -184,10 +197,10 @@ -- See <https://en.wikipedia.org/wiki/Yard here> for further information.
 --
 -- >>> 1 *~ yard
--- 0.9144 m
+-- 0.9144 m
 --
 -- >>> 1 *~ yard :: Length Rational
--- 1143 % 1250 m
+-- 1143 % 1250 m
 yard :: (Fractional a) => Unit 'NonMetric DLength a
 yard = mkUnitQ (ucum "[yd_i]" "yd" "yard") 0.9144 $ meter
 
@@ -198,12 +211,12 @@ -- See <https://en.wikipedia.org/wiki/Mile#International_mile here> for further information.
 --
 -- >>> 1 *~ mile
--- 1609.344 m
+-- 1609.344 m
 --
 -- prop> 1 *~ mile === 5280 *~ foot
 --
 -- >>> 1 *~ mile :: Length Rational
--- 201168 % 125 m
+-- 201168 % 125 m
 mile :: (Fractional a) => Unit 'NonMetric DLength a
 mile = mkUnitQ (ucum "[mi_i]" "mi" "mile") 5280 $ foot
 
@@ -216,12 +229,12 @@ -- See <https://en.wikipedia.org/wiki/Acre#Differences_between_international_and_US_survey_acres here> for further information.
 --
 -- >>> 1 *~ acre
--- 4046.8564224 m^2
+-- 4046.8564224 m^2
 --
 -- prop> 1 *~ acre === 43560 *~ foot ^ pos2
 --
 -- >>> 1 *~ acre :: Area Rational
--- 316160658 % 78125 m^2
+-- 316160658 % 78125 m^2
 acre :: (Fractional a) => Unit 'NonMetric DArea a
 acre = mkUnitQ (dimensionalAtom "[acr_i]" "ac" "acre") 43560 $ square foot
 
@@ -233,10 +246,10 @@ -- See <https://en.wikipedia.org/wiki/Foot_%28unit%29#US_survey_foot here> for further information.
 --
 -- >>> 1 *~ usSurveyFoot
--- 0.3048006096012192 m
+-- 0.3048006096012192 m
 --
 -- >>> 1 *~ usSurveyFoot :: Length Rational
--- 1200 % 3937 m
+-- 1200 % 3937 m
 usSurveyFoot :: Fractional a => Unit 'NonMetric DLength a
 usSurveyFoot = mkUnitQ (ucum "[ft_us]" "ft" "foot") (1200 Prelude./ 3937) $ meter
 
@@ -248,12 +261,12 @@ -- See <https://en.wikipedia.org/wiki/Inch here> for further information.
 --
 -- >>> 1 *~ usSurveyInch
--- 2.54000508001016e-2 m
+-- 2.54000508001016e-2 m
 --
 -- prop> 12 *~ usSurveyInch === 1 *~ usSurveyFoot
 --
 -- >>> 1 *~ usSurveyInch :: Length Rational
--- 100 % 3937 m
+-- 100 % 3937 m
 usSurveyInch :: Fractional a => Unit 'NonMetric DLength a
 usSurveyInch = mkUnitQ (ucum "[in_us]" "in" "inch") (1 Prelude./ 12) $ usSurveyFoot
 
@@ -265,12 +278,12 @@ -- See <https://en.wikipedia.org/wiki/Thousandth_of_an_inch here> for further information.
 --
 -- >>> 1 *~ usSurveyMil
--- 2.54000508001016e-5 m
+-- 2.54000508001016e-5 m
 --
 -- prop> 1000 *~ usSurveyMil === 1 *~ usSurveyInch
 --
 -- >>> 1 *~ usSurveyMil :: Length Rational
--- 1 % 39370 m
+-- 1 % 39370 m
 usSurveyMil :: Fractional a => Unit 'NonMetric DLength a
 usSurveyMil = mkUnitQ (ucum "[mil_us]" "mil" "mil") 0.001 $ usSurveyInch
 
@@ -282,12 +295,12 @@ -- See <https://en.wikipedia.org/wiki/Yard here> for further information.
 --
 -- >>> 1 *~ usSurveyYard
--- 0.9144018288036576 m
+-- 0.9144018288036576 m
 --
 -- prop> 1 *~ usSurveyYard === 3 *~ usSurveyFoot
 --
 -- >>> 1 *~ usSurveyYard :: Length Rational
--- 3600 % 3937 m
+-- 3600 % 3937 m
 usSurveyYard :: (Fractional a) => Unit 'NonMetric DLength a
 usSurveyYard = mkUnitQ (ucum "[yd_us]" "yd" "yard") 3 $ usSurveyFoot
 
@@ -299,12 +312,12 @@ -- See <https://en.wikipedia.org/wiki/Mile#US_survey_mile here> for further information.
 --
 -- >>> 1 *~ usSurveyMile
--- 1609.3472186944373 m
+-- 1609.3472186944373 m
 --
 -- prop> 1 *~ usSurveyMile === 5280 *~ usSurveyFoot
 --
 -- >>> 1 *~ usSurveyMile :: Length Rational
--- 6336000 % 3937 m
+-- 6336000 % 3937 m
 usSurveyMile :: (Fractional a) => Unit 'NonMetric DLength a
 usSurveyMile = mkUnitQ (ucum "[mi_us]" "mi" "mile") 5280 $ usSurveyFoot
 
@@ -317,12 +330,12 @@ -- See <https://en.wikipedia.org/wiki/Acre#Differences_between_international_and_US_survey_acres here> for further information.
 --
 -- >>> 1 *~ usSurveyAcre
--- 4046.872609874252 m^2
+-- 4046.872609874252 m^2
 --
 -- prop> 1 *~ usSurveyAcre === 43560 *~ usSurveyFoot ^ pos2
 --
 -- >>> 1 *~ usSurveyAcre :: Area Rational
--- 62726400000 % 15499969 m^2
+-- 62726400000 % 15499969 m^2
 usSurveyAcre :: (Fractional a) => Unit 'NonMetric DArea a
 usSurveyAcre = mkUnitQ (ucum "[acr_us]" "ac" "acre") 43560 $ square usSurveyFoot
 
@@ -332,10 +345,10 @@ -- See <https://en.wikipedia.org/wiki/Avoirdupois#Internationalization here> for further information.
 --
 -- >>> 1 *~ poundMass
--- 0.45359237 kg
+-- 0.45359237 kg
 --
 -- >>> 1 *~ poundMass :: Mass Rational
--- 45359237 % 100000000 kg
+-- 45359237 % 100000000 kg
 poundMass :: Fractional a => Unit 'NonMetric DMass a
 poundMass = mkUnitQ (ucum "[lb_av]" "lb" "pound") 0.45359237 $ kilo gram
 
@@ -344,12 +357,12 @@ -- See <https://en.wikipedia.org/wiki/Ounce#International_avoirdupois_ounce here> for further information.
 --
 -- >>> 1 *~ ounce
--- 2.8349523125e-2 kg
+-- 2.8349523125e-2 kg
 --
 -- prop> 16 *~ ounce === 1 *~ poundMass
 --
 -- >>> 1 *~ ounce :: Mass Rational
--- 45359237 % 1600000000 kg
+-- 45359237 % 1600000000 kg
 ounce :: Fractional a => Unit 'NonMetric DMass a
 ounce = mkUnitQ (ucum "[oz_av]" "oz" "ounce") (1 Prelude./ 16) $ poundMass
 
@@ -358,10 +371,10 @@ -- See <https://en.wikipedia.org/wiki/Short_ton#United_States here> for further information.
 --
 -- >>> 1 *~ shortTon
--- 907.18474 kg
+-- 907.18474 kg
 --
 -- >>> 1 *~ shortTon :: Mass Rational
--- 45359237 % 50000 kg
+-- 45359237 % 50000 kg
 shortTon :: Fractional a => Unit 'NonMetric DMass a
 shortTon = mkUnitQ (ucum "[ston_av]" "ton" "short ton") 2000 $ poundMass
 
@@ -374,12 +387,12 @@ -- See <https://en.wikipedia.org/wiki/Pound_%28force%29 here> for further information.
 --
 -- >>> 1 *~ poundForce
--- 4.4482216152605 m kg s^-2
+-- 4.4482216152605 m kg s^-2
 --
 -- prop> 1 *~ poundForce === 1 *~ poundMass * (1 *~ gee)
 --
 -- >>> 1 *~ poundForce :: Force Rational
--- 8896443230521 % 2000000000000 m kg s^-2
+-- 8896443230521 % 2000000000000 m kg s^-2
 poundForce :: Fractional a => Unit 'NonMetric DForce a
 poundForce = mkUnitQ (ucum "[lbf_av]" "lbf" "pound force") 1 $ poundMass * gee
 
@@ -390,12 +403,12 @@ -- See <https://en.wikipedia.org/wiki/Horsepower#Mechanical_horsepower here> for further information.
 --
 -- >>> 1 *~ horsepower
--- 745.6998715822702 m^2 kg s^-3
+-- 745.6998715822702 m^2 kg s^-3
 --
 -- prop> 1 *~ horsepower === 550 *~ poundForce * (1 *~ foot) / (1 *~ second)
 --
 -- >>> 1 *~ horsepower :: Power Rational
--- 37284993579113511 % 50000000000000 m^2 kg s^-3
+-- 37284993579113511 % 50000000000000 m^2 kg s^-3
 horsepower :: Fractional a => Unit 'NonMetric DPower a
 horsepower = mkUnitQ (ucum "[HP]" "hp" "horsepower") 550 $ foot * poundForce / second
 
@@ -407,10 +420,10 @@ -- See <https://en.wikipedia.org/wiki/Slug_%28mass%29 here> for further information.
 --
 -- >>> 1 *~ slug
--- 14.593902937206364 kg
+-- 14.593902937206364 kg
 --
 -- >>> 1 *~ slug :: Mass Rational
--- 8896443230521 % 609600000000 kg
+-- 8896443230521 % 609600000000 kg
 slug :: Fractional a => Unit 'NonMetric DMass a
 slug = mkUnitQ (dimensionalAtom "slug" "slug" "slug") 1 $ poundForce * (second^pos2) / foot
 
@@ -419,10 +432,10 @@ -- See <https://en.wikipedia.org/wiki/Pounds_per_square_inch here> for further information.
 --
 -- >>> 1 *~ psi
--- 6894.757293168362 m^-1 kg s^-2
+-- 6894.757293168362 m^-1 kg s^-2
 --
 -- >>> 1 *~ psi :: Pressure Rational
--- 8896443230521 % 1290320000 m^-1 kg s^-2
+-- 8896443230521 % 1290320000 m^-1 kg s^-2
 psi :: Fractional a => Unit 'NonMetric DPressure a
 psi = mkUnitQ (ucum "[psi]" "psi" "pound per square inch") 1 $ poundForce / inch ^ pos2
 
@@ -433,10 +446,10 @@ -- See <https://en.wikipedia.org/wiki/Nautical_mile here> for further information.
 --
 -- >>> 1 *~ nauticalMile
--- 1852.0 m
+-- 1852.0 m
 --
 -- >>> 1 *~ nauticalMile :: Length Rational
--- 1852 % 1 m
+-- 1852 % 1 m
 nauticalMile :: (Num a) => Unit 'NonMetric DLength a
 nauticalMile = mkUnitZ (ucum "[nmi_i]" "NM" "nautical mile") 1852 $ meter
 
@@ -445,10 +458,10 @@ -- See <https://en.wikipedia.org/wiki/Knot_%28unit%29 here> for further information.
 --
 -- >>> 1 *~ knot
--- 0.5144444444444445 m s^-1
+-- 0.5144444444444445 m s^-1
 --
 -- >>> 1 *~ knot :: Velocity Rational
--- 463 % 900 m s^-1
+-- 463 % 900 m s^-1
 knot :: (Fractional a) => Unit 'NonMetric DVelocity a
 knot = mkUnitQ (ucum "[kt_i]" "kt" "knot") 1 $ nauticalMile / hour
 
@@ -481,10 +494,10 @@ -- See <https://en.wikipedia.org/wiki/British_thermal_unit#Definitions here> for further information.
 --
 -- >>> 1 *~ btu
--- 1055.05585262 m^2 kg s^-2
+-- 1055.05585262 m^2 kg s^-2
 --
 -- >>> 1 *~ btu :: Energy Rational
--- 52752792631 % 50000000 m^2 kg s^-2
+-- 52752792631 % 50000000 m^2 kg s^-2
 btu :: Fractional a => Unit 'NonMetric DEnergy a
 btu = mkUnitQ (ucum "[Btu_IT]" "btu" "British thermal unit") 1055.05585262 $ joule
 
@@ -504,20 +517,20 @@ -- See <https://en.wikipedia.org/wiki/Julian_year_%28astronomy%29 here> for further information.
 --
 -- >>> 1 *~ year
--- 3.15576e7 s
+-- 3.15576e7 s
 --
 -- >>> 1 *~ year :: Time Rational
--- 31557600 % 1 s
+-- 31557600 % 1 s
 year :: Num a => Unit 'NonMetric DTime a
 year = mkUnitZ (ucum "a_j" "a" "mean Julian year") 31557600 $ second
 
 -- | One mean Julian century is one hundred mean Julian 'year's.
 --
 -- >>> 1 *~ century
--- 3.15576e9 s
+-- 3.15576e9 s
 --
 -- >>> 1 *~ century :: Time Rational
--- 3155760000 % 1 s
+-- 3155760000 % 1 s
 century :: Num a => Unit 'NonMetric DTime a
 century = mkUnitZ (dimensionalAtom "c_j" "cen" "mean Julian century") 100 $ year
 
@@ -533,10 +546,10 @@ --  It is about equal to the atmospheric pressure on Earth at sea level.
 --
 -- >>> 1 *~ bar
--- 100000.0 m^-1 kg s^-2
+-- 100000.0 m^-1 kg s^-2
 --
 -- >>> 1 *~ bar :: Pressure Rational
--- 100000 % 1 m^-1 kg s^-2
+-- 100000 % 1 m^-1 kg s^-2
 bar :: (Num a) => Unit 'Metric DPressure a
 bar = mkUnitZ (ucumMetric "bar" "bar" "bar") 1e5 $ pascal
 
@@ -549,10 +562,10 @@ --  level.
 --
 -- >>> 1 *~ atmosphere
--- 101325.0 m^-1 kg s^-2
+-- 101325.0 m^-1 kg s^-2
 --
 -- >>> 1 *~ atmosphere :: Pressure Rational
--- 101325 % 1 m^-1 kg s^-2
+-- 101325 % 1 m^-1 kg s^-2
 atmosphere :: (Num a) => Unit 'NonMetric DPressure a
 atmosphere = mkUnitZ (ucum "atm" "atm" "standard atmosphere") 101325 $ pascal
 
@@ -564,10 +577,10 @@ --  to one kilogram-force per square centimeter.
 --
 -- >>> 1 *~ technicalAtmosphere
--- 98066.5 m^-1 kg s^-2
+-- 98066.5 m^-1 kg s^-2
 --
 -- >>> 1 *~ technicalAtmosphere :: Pressure Rational
--- 196133 % 2 m^-1 kg s^-2
+-- 196133 % 2 m^-1 kg s^-2
 technicalAtmosphere :: (Fractional a) => Unit 'NonMetric DPressure a
 technicalAtmosphere = mkUnitQ (ucum "att" "at" "technical atmosphere") 1 $ kilo gram * gee * centi meter ^ neg2
 
@@ -583,10 +596,10 @@ -- at 0 deg. Under most conditions, 1 mmHg is approximately equal to 1 'torr'.
 --
 -- >>> 1 *~ mmHg
--- 133.322 m^-1 kg s^-2
+-- 133.322 m^-1 kg s^-2
 --
 -- >>> 1 *~ mmHg :: Pressure Rational
--- 66661 % 500 m^-1 kg s^-2
+-- 66661 % 500 m^-1 kg s^-2
 mmHg :: (Fractional a) => Unit 'NonMetric DPressure a
 mmHg = milli mHg
 
@@ -601,10 +614,10 @@ -- This is the value defined by UCUM. For the value defined by NIST, see 'inHg_NIST'.
 --
 -- >>> 1 *~ inHg
--- 3386.3788 m^-1 kg s^-2
+-- 3386.3788 m^-1 kg s^-2
 --
 -- >>> 1 *~ inHg :: Pressure Rational
--- 8465947 % 2500 m^-1 kg s^-2
+-- 8465947 % 2500 m^-1 kg s^-2
 inHg :: (Fractional a) => Unit 'NonMetric DPressure a
 inHg = inHg_UCUM
 
@@ -616,10 +629,10 @@ -- This is the value defined by UCUM. For the value defined by NIST, see 'inHg_NIST'.
 --
 -- >>> 1 *~ inHg_UCUM
--- 3386.3788 m^-1 kg s^-2
+-- 3386.3788 m^-1 kg s^-2
 --
 -- >>> 1 *~ inHg_UCUM :: Pressure Rational
--- 8465947 % 2500 m^-1 kg s^-2
+-- 8465947 % 2500 m^-1 kg s^-2
 inHg_UCUM :: (Fractional a) => Unit 'NonMetric DPressure a
 inHg_UCUM = mkUnitQ (ucum "[in_i'Hg]" "in Hg" "inch of mercury") 1 $ mHg * inch / meter
 
@@ -631,10 +644,10 @@ -- This is the value defined by NIST. For the value defined by UCUM, see 'inHg_UCUM'.
 --
 -- >>> 1 *~ inHg_NIST
--- 3386.389 m^-1 kg s^-2
+-- 3386.389 m^-1 kg s^-2
 --
 -- >>> 1 *~ inHg_NIST :: Pressure Rational
--- 3386389 % 1000 m^-1 kg s^-2
+-- 3386389 % 1000 m^-1 kg s^-2
 inHg_NIST :: (Fractional a) => Unit 'NonMetric DPressure a
 inHg_NIST = mkUnitQ (dimensionalAtom "[in_i'Hg_NIST]" "in Hg" "inch of mercury") 3.386389e3 $ pascal
 
@@ -643,10 +656,10 @@ -- See <https://en.wikipedia.org/wiki/Torr here> for further information.
 --
 -- >>> 1 *~ torr
--- 133.32236842105263 m^-1 kg s^-2
+-- 133.32236842105263 m^-1 kg s^-2
 --
 -- >>> 1 *~ torr :: Pressure Rational
--- 20265 % 152 m^-1 kg s^-2
+-- 20265 % 152 m^-1 kg s^-2
 torr :: (Fractional a) => Unit 'NonMetric DPressure a
 torr = mkUnitQ (dimensionalAtom "Torr" "Torr" "Torr") (1 Prelude./ 760) $ atmosphere
 
@@ -656,10 +669,10 @@ -- See <https://en.wikipedia.org/wiki/Rad_%28unit%29 here> for further information.
 --
 -- >>> 1 *~ rad
--- 1.0e-2 m^2 s^-2
+-- 1.0e-2 m^2 s^-2
 --
 -- >>> 1 *~ rad :: AbsorbedDose Rational
--- 1 % 100 m^2 s^-2
+-- 1 % 100 m^2 s^-2
 rad :: (Fractional a) => Unit 'Metric DAbsorbedDose a
 rad = mkUnitQ (ucumMetric "RAD" "RAD" "RAD") 1 $ centi gray
 
@@ -668,10 +681,10 @@ -- See <https://en.wikipedia.org/wiki/Viscosity#Kinematic_viscosity_.CE.BD here> for further information.
 --
 -- >>> 1 *~ stokes
--- 1.0e-4 m^2 s^-1
+-- 1.0e-4 m^2 s^-1
 --
 -- >>> 1 *~ stokes :: KinematicViscosity Rational
--- 1 % 10000 m^2 s^-1
+-- 1 % 10000 m^2 s^-1
 stokes :: (Fractional a) => Unit 'Metric DKinematicViscosity a
 stokes = mkUnitQ (ucumMetric "St" "St" "Stokes") 1 $ centi meter ^ pos2 / second
 
@@ -687,10 +700,10 @@ -- See <https://en.wikipedia.org/wiki/Fahrenheit#Definition_and_conversions here> for further information.
 --
 -- >>> 1 *~ degreeFahrenheit
--- 0.5555555555555556 K
+-- 0.5555555555555556 K
 --
 -- >>> 1 *~ degreeFahrenheit :: ThermodynamicTemperature Rational
--- 5 % 9 K
+-- 5 % 9 K
 degreeFahrenheit :: (Fractional a) => Unit 'NonMetric DThermodynamicTemperature a
 degreeFahrenheit = mkUnitQ (ucum "[degF]" "°F" "degree Fahrenheit") (5 Prelude./ 9) $ degreeCelsius
 
@@ -702,10 +715,10 @@ -- See <https://en.wikipedia.org/wiki/Rankine_scale here> for further information.
 --
 -- >>> 1 *~ degreeRankine
--- 0.5555555555555556 K
+-- 0.5555555555555556 K
 --
 -- >>> 1 *~ degreeRankine :: ThermodynamicTemperature Rational
--- 5 % 9 K
+-- 5 % 9 K
 degreeRankine :: (Fractional a) => Unit 'NonMetric DThermodynamicTemperature a
 degreeRankine = mkUnitQ (ucum "[degR]" "°R" "degree Rankine") 1 $ degreeFahrenheit
 
@@ -719,10 +732,10 @@ -- See <https://en.wikipedia.org/wiki/Imperial_units#Volume here> for further information.
 --
 -- >>> 1 *~ imperialGallon
--- 4.54609e-3 m^3
+-- 4.54609e-3 m^3
 --
 -- >>> 1 *~ imperialGallon :: Volume Rational
--- 454609 % 100000000 m^3
+-- 454609 % 100000000 m^3
 imperialGallon :: (Fractional a) => Unit 'NonMetric DVolume a
 imperialGallon = mkUnitQ (ucum "[gal_br]" "gal" "gallon") 4.54609 $ liter
 
@@ -731,10 +744,10 @@ -- See <https://en.wikipedia.org/wiki/Imperial_units#Volume here> for further information.
 --
 -- >>> 1 *~ imperialQuart
--- 1.1365225e-3 m^3
+-- 1.1365225e-3 m^3
 --
 -- >>> 1 *~ imperialQuart :: Volume Rational
--- 454609 % 400000000 m^3
+-- 454609 % 400000000 m^3
 imperialQuart :: (Fractional a) => Unit 'NonMetric DVolume a
 imperialQuart = mkUnitQ (ucum "[qt_br]" "qt" "quart") (1 Prelude./ 4) $ imperialGallon
 
@@ -743,10 +756,10 @@ -- See <https://en.wikipedia.org/wiki/Imperial_units#Volume here> for further information.
 --
 -- >>> 1 *~ imperialPint
--- 5.6826125e-4 m^3
+-- 5.6826125e-4 m^3
 --
 -- >>> 1 *~ imperialPint :: Volume Rational
--- 454609 % 800000000 m^3
+-- 454609 % 800000000 m^3
 imperialPint :: (Fractional a) => Unit 'NonMetric DVolume a
 imperialPint = mkUnitQ (ucum "[pt_br]" "pt" "pint") (1 Prelude./ 8) $ imperialGallon
 
@@ -758,10 +771,10 @@ -- See <https://en.wikipedia.org/wiki/Cup_%28unit%29#Imperial_cup here> for further information.
 --
 -- >>> 1 *~ imperialCup
--- 2.84130625e-4 m^3
+-- 2.84130625e-4 m^3
 --
 -- >>> 1 *~ imperialCup :: Volume Rational
--- 454609 % 1600000000 m^3
+-- 454609 % 1600000000 m^3
 imperialCup :: (Fractional a) => Unit 'NonMetric DVolume a
 imperialCup = mkUnitQ (dimensionalAtom "[cup_br]" "cup" "cup") 0.5 $ imperialPint
 
@@ -770,10 +783,10 @@ -- See <https://en.wikipedia.org/wiki/Imperial_units#Volume here> for further information.
 --
 -- >>> 1 *~ imperialGill
--- 1.420653125e-4 m^3
+-- 1.420653125e-4 m^3
 --
 -- >>> 1 *~ imperialGill :: Volume Rational
--- 454609 % 3200000000 m^3
+-- 454609 % 3200000000 m^3
 imperialGill :: (Fractional a) => Unit 'NonMetric DVolume a
 imperialGill = mkUnitQ (ucum "[gil_br]" "gill" "gill") (1 Prelude./ 4) $ imperialPint
 
@@ -782,10 +795,10 @@ -- See <https://en.wikipedia.org/wiki/Imperial_units#Volume here> for further information.
 --
 -- >>> 1 *~ imperialFluidOunce
--- 2.84130625e-5 m^3
+-- 2.84130625e-5 m^3
 --
 -- >>> 1 *~ imperialFluidOunce :: Volume Rational
--- 454609 % 16000000000 m^3
+-- 454609 % 16000000000 m^3
 imperialFluidOunce :: (Fractional a) => Unit 'NonMetric DVolume a
 imperialFluidOunce = mkUnitQ (ucum "[foz_br]" "fl oz" "fluid ounce") (1 Prelude./ 20) $ imperialPint
 
@@ -799,22 +812,22 @@ -- See <https://en.wikipedia.org/wiki/Gallon#The_US_liquid_gallon here> for further information.
 --
 -- >>> 1 *~ usGallon
--- 3.785411784e-3 m^3
+-- 3.785411784e-3 m^3
 --
 -- >>> 1 *~ usGallon :: Volume Rational
--- 473176473 % 125000000000 m^3
+-- 473176473 % 125000000000 m^3
 usGallon :: (Fractional a) => Unit 'NonMetric DVolume a
-usGallon = mkUnitQ (ucum "[gal_us]" "gal" "gallon") 231 $ (cubic inch)
+usGallon = mkUnitQ (ucum "[gal_us]" "gal" "gallon") 231 $ cubic inch
 
 -- | One US liquid quart is one quarter of a 'usGallon'.
 --
 -- See <https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume here> for further information.
 --
 -- >>> 1 *~ usQuart
--- 9.46352946e-4 m^3
+-- 9.46352946e-4 m^3
 --
 -- >>> 1 *~ usQuart :: Volume Rational
--- 473176473 % 500000000000 m^3
+-- 473176473 % 500000000000 m^3
 usQuart :: (Fractional a) => Unit 'NonMetric DVolume a
 usQuart = mkUnitQ (ucum "[qt_us]" "qt" "quart") (1 Prelude./ 4) $ usGallon
 
@@ -823,10 +836,10 @@ -- See <https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume here> for further information.
 --
 -- >>> 1 *~ usPint
--- 4.73176473e-4 m^3
+-- 4.73176473e-4 m^3
 --
 -- >>> 1 *~ usPint :: Volume Rational
--- 473176473 % 1000000000000 m^3
+-- 473176473 % 1000000000000 m^3
 usPint :: (Fractional a) => Unit 'NonMetric DVolume a
 usPint = mkUnitQ (ucum "[pt_us]" "pt" "pint") (1 Prelude./ 8) $ usGallon
 
@@ -835,10 +848,10 @@ -- See <https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume here> for further information.
 --
 -- >>> 1 *~ usCup
--- 2.365882365e-4 m^3
+-- 2.365882365e-4 m^3
 --
 -- >>> 1 *~ usCup :: Volume Rational
--- 473176473 % 2000000000000 m^3
+-- 473176473 % 2000000000000 m^3
 usCup :: (Fractional a) => Unit 'NonMetric DVolume a
 usCup = mkUnitQ (ucum "[cup_us]" "cup" "cup") (1 Prelude./ 2) $ usPint
 
@@ -847,10 +860,10 @@ -- See <https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume here> for further information.
 --
 -- >>> 1 *~ usGill
--- 1.1829411825e-4 m^3
+-- 1.1829411825e-4 m^3
 --
 -- >>> 1 *~ usGill :: Volume Rational
--- 473176473 % 4000000000000 m^3
+-- 473176473 % 4000000000000 m^3
 usGill :: (Fractional a) => Unit 'NonMetric DVolume a
 usGill = mkUnitQ (ucum "[gil_us]" "gill" "gill") (1 Prelude./ 4) $ usPint
 
@@ -859,10 +872,10 @@ -- See <https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume here> for further information.
 --
 -- >>> 1 *~ usFluidOunce
--- 2.95735295625e-5 m^3
+-- 2.95735295625e-5 m^3
 --
 -- >>> 1 *~ usFluidOunce :: Volume Rational
--- 473176473 % 16000000000000 m^3
+-- 473176473 % 16000000000000 m^3
 usFluidOunce :: (Fractional a) => Unit 'NonMetric DVolume a
 usFluidOunce = mkUnitQ (ucum "[foz_us]" "fl oz" "fluid ounce") (1 Prelude./ 16) $ usPint -- sic, does not match factor used in imperial system
 
@@ -871,10 +884,10 @@ -- See <https://en.wikipedia.org/wiki/%C3%85ngstr%C3%B6m here> for further information.
 --
 -- >>> 1 *~ angstrom
--- 1.0e-10 m
+-- 1.0e-10 m
 --
 -- >>> 1 *~ angstrom :: Length Rational
--- 1 % 10000000000 m
+-- 1 % 10000000000 m
 angstrom :: (Fractional a) => Unit 'NonMetric DLength a
 angstrom = mkUnitQ (ucum "Ao" "Å" "Ångström") 0.1 $ nano meter
 
@@ -883,9 +896,9 @@ -- See <https://en.wikipedia.org/wiki/Gauss_%28unit%29 here> for further information.
 --
 -- >>> 1 *~ gauss
--- 1.0e-4 kg s^-2 A^-1
+-- 1.0e-4 kg s^-2 A^-1
 --
 -- >>> 1 *~ gauss :: MagneticFluxDensity Rational
--- 1 % 10000 kg s^-2 A^-1
+-- 1 % 10000 kg s^-2 A^-1
 gauss :: (Fractional a) => Unit 'NonMetric DMagneticFluxDensity a
 gauss = mkUnitQ (ucum "G" "G" "Gauss") 1e-4 $ tesla
src/Numeric/Units/Dimensional/SIUnits.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-}
-{-# LANGUAGE NumDecimals #-}
 {-# LANGUAGE RankNTypes #-}
 
 {- |
src/Numeric/Units/Dimensional/UnitNames/Internal.hs view
@@ -1,7 +1,6 @@ {-# OPTIONS_HADDOCK not-home #-}
 
 {-# LANGUAGE AutoDeriveTypeable #-}
-{-# LANGUAGE CPP #-}
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE DeriveGeneric #-}
@@ -20,11 +19,7 @@ import Control.Monad (join)
 import Data.Coerce
 import Data.Data hiding (Prefix)
-#if MIN_VERSION_base(4, 8, 0)
 import Data.Foldable (toList)
-#else
-import Data.Foldable (Foldable, toList)
-#endif
 import Data.Ord
 import GHC.Generics hiding (Prefix)
 import Numeric.Units.Dimensional.Dimensions.TermLevel (Dimension', asList, HasDimension(..))
@@ -73,13 +68,14 @@     Grouped n' -> rnf n'
     Weaken n' -> rnf n'
 
+-- | `UnitName`s are shown with non-breaking spaces.
 instance Show (UnitName m) where
   show One = "1"
   show (MetricAtomic a) = abbreviation_en a
   show (Atomic a) = abbreviation_en a
   show (Prefixed a n) = abbreviation_en a ++ show n
-  show (Product n1 n2) = show n1 ++ " " ++ show n2
-  show (Quotient n1 n2) = show n1 ++ " / " ++ show n2
+  show (Product n1 n2) = show n1 ++ "\xA0" ++ show n2
+  show (Quotient n1 n2) = show n1 ++ "\xA0/\xA0" ++ show n2
   show (Power x n) = show x ++ "^" ++ show n
   show (Grouped n) = "(" ++ show n ++ ")"
   show (Weaken n) = show n
@@ -87,11 +83,11 @@ asAtomic :: UnitName m -> Maybe (NameAtom ('UnitAtom m))
 asAtomic (MetricAtomic a) = Just a
 asAtomic (Atomic a) = Just a
-asAtomic (Weaken n) = fmap coerce $ asAtomic n
+asAtomic (Weaken n) = coerce <$> asAtomic n
 asAtomic _ = Nothing
 
 isAtomic :: UnitName m -> Bool
-isAtomic (One) = True
+isAtomic One = True
 isAtomic (MetricAtomic _) = True
 isAtomic (Atomic _) = True
 isAtomic (Prefixed _ _) = True
@@ -105,13 +101,13 @@ 
 -- reduce by algebraic simplifications
 reduce :: UnitName m -> UnitName m
-reduce (One) = One
+reduce One = One
 reduce n@(MetricAtomic _) = n
 reduce n@(Atomic _) = n
 reduce n@(Prefixed _ _) = n
 reduce (Product n1 n2) = reduce' (reduce n1 * reduce n2)
 reduce (Quotient n1 n2) = reduce' (reduce n1 * reduce n2)
-reduce (Power n x) = reduce' ((reduce n) ^ x)
+reduce (Power n x) = reduce' (reduce n ^ x)
 reduce (Grouped n) = reduce' (Grouped (reduce n))
 reduce (Weaken n) = reduce' (Weaken (reduce n))
 
@@ -267,7 +263,7 @@ -- strengthening or weakening if neccessary. Because it may not be possible to strengthen,
 -- the result is returned in a 'Maybe' wrapper.
 relax :: forall m1 m2.(Typeable m1, Typeable m2) => UnitName m1 -> Maybe (UnitName m2)
-relax n = go (typeRep (Proxy :: Proxy m1)) (typeRep (Proxy :: Proxy m2)) n
+relax = go (typeRep (Proxy :: Proxy m1)) (typeRep (Proxy :: Proxy m2))
   where
     metric = typeRep (Proxy :: Proxy 'Metric)
     nonMetric = typeRep (Proxy :: Proxy 'NonMetric)
@@ -313,14 +309,14 @@   -- TODO #109: note in this case that the UCUM is changing their grammar to not accept exponents after
   -- as a result it will become necessary to distribute the exponentiation over the items in the base name
   -- prior to generating the interchange name
-  interchangeName (Power n x) = let n' = (name . interchangeName $ n) ++ (show x)
+  interchangeName (Power n x) = let n' = (name . interchangeName $ n) ++ show x
                                  in InterchangeName { name = n', authority = authority . interchangeName $ n, I.isAtomic = False }
   interchangeName (Grouped n) = let n' = "(" ++ (name . interchangeName $ n) ++ ")"
                                  in InterchangeName { name = n', authority = authority . interchangeName $ n, I.isAtomic = False }
   interchangeName (Weaken n) = interchangeName n
 
 prefix :: String -> String -> String -> Rational -> Prefix
-prefix i a f q = Prefix n q
+prefix i a f = Prefix n
   where
     n = NameAtom (InterchangeName i UCUM True) a f
 
tests/Numeric/Units/DimensionalSpec.hs view
@@ -17,10 +17,11 @@ 
          describe "Show instance" $ do
            it "properly prints basic quantities" $ do
+             -- note: these comparison literals use non-breaking spaces
              show ((1.0::Double) *~ one) `shouldBe` "1.0"
-             show ((2.0::Double) *~ meter) `shouldBe` "2.0 m"
-             show ((2.0::Double) *~ (meter / second)) `shouldBe` "2.0 m s^-1"
-             show ((2.0::Double) *~ (meter ^ pos2 / second ^ pos2)) `shouldBe` "2.0 m^2 s^-2"
+             show ((2.0::Double) *~ meter) `shouldBe` "2.0 m"
+             show ((2.0::Double) *~ (meter / second)) `shouldBe` "2.0 m s^-1"
+             show ((2.0::Double) *~ (meter ^ pos2 / second ^ pos2)) `shouldBe` "2.0 m^2 s^-2"
 
          describe "Ord instance" $ do
            it "properly sorts quantities" $ do