haskellator-0.1.0.0: SI-Units supporting calculator
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Haskellator.Internal.TH.DerivedUnitGeneration

Description

Generate the unit types and function to work with them

Synopsis

Documentation

data DQuantity Source #

A derived quantity. Works in the same way as Quantity, but with an additional Dimension representing it.

generateDerivedUnits :: [DQuantity] -> Q [Dec] Source #

Since derived units are instantly converted to the Dimension representing them, this function will only generate one additional function derivedUnitFromString. Imagine the call generateDerivedUnits [DQuantity (UnitDef Herz Hz 1) [UnitExp Second (-1)] [] [].

derivedUnitFromString :: String -> Either String Dimension
derivedUnitFromString "Hz" = Right [UnitExp Second (-1)]
derivedUnitFromString x = Left x