Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Generate the unit types and function to work with them
Documentation
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