NumericPrelude-0.0: An experimental alternative hierarchy of numeric type classesContentsIndex
Number.Physical.UnitDatabase
Portabilityportable
Stabilityprovisional
Maintainernumericprelude@henning-thielemann.de
Description
Tools for creating a data base of physical units and for extracting data from it
Synopsis
type T i a = [UnitSet i a]
data InitUnitSet i a = InitUnitSet {
initUnit :: (T i)
initIndependent :: Bool
initScales :: [InitScale a]
}
data InitScale a = InitScale {
initSymbol :: String
initMag :: a
initIsUnit :: Bool
initDefault :: Bool
}
data UnitSet i a = UnitSet {
unit :: (T i)
independent :: Bool
defScaleIx :: Int
reciprocal :: Bool
scales :: [Scale a]
}
data Scale a = Scale {
symbol :: String
magnitude :: a
}
extractOne :: [a] -> a
initScale :: String -> a -> Bool -> Bool -> InitScale a
initUnitSet :: T i -> Bool -> [InitScale a] -> InitUnitSet i a
createScale :: InitScale a -> Scale a
createUnitSet :: InitUnitSet i a -> UnitSet i a
showableUnit :: InitUnitSet i a -> Maybe (InitUnitSet i a)
powerOfUnitSet :: (Ord i, C a) => Int -> UnitSet i a -> UnitSet i a
powerOfScale :: C a => Int -> Scale a -> Scale a
showExp :: Int -> String
positiveToFront :: [UnitSet i a] -> [UnitSet i a]
decompose :: (Ord i, C a) => T i -> T i a -> [UnitSet i a]
findIndep :: Eq i => T i -> T i a -> Maybe (UnitSet i a)
findClosest :: (Ord i, C a) => T i -> T i a -> UnitSet i a
evalDist :: (Ord i, C a) => T i -> T i a -> [(UnitSet i a, Int)]
findBestExp :: Ord i => T i -> T i -> (Int, Int)
findMinExp :: [(Int, Int)] -> (Int, Int)
distLE :: (Int, Int) -> (Int, Int) -> Bool
distances :: Ord i => T i -> [(Int, T i)] -> [(Int, Int)]
listMultiples :: (T i -> T i) -> Int -> [(Int, T i)]
Documentation
type T i a = [UnitSet i a]
data InitUnitSet i a
Constructors
InitUnitSet
initUnit :: (T i)
initIndependent :: Bool
initScales :: [InitScale a]
data InitScale a
Constructors
InitScale
initSymbol :: String
initMag :: a
initIsUnit :: Bool
initDefault :: Bool
data UnitSet i a
An entry for a unit and there scalings.
Constructors
UnitSet
unit :: (T i)
independent :: Bool
defScaleIx :: Int
reciprocal :: BoolIf True the symbols must be preceded with a /. Though it sounds like an attribute of Scale it must be the same for all scales and we need it to sort positive powered unitsets to the front of the list of unit components.
scales :: [Scale a]
show/hide Instances
??? a i => Show (UnitSet i a)
data Scale a
A common scaling for a unit.
Constructors
Scale
symbol :: String
magnitude :: a
show/hide Instances
Show a => Show (Scale a)
extractOne :: [a] -> a
initScale :: String -> a -> Bool -> Bool -> InitScale a
initUnitSet :: T i -> Bool -> [InitScale a] -> InitUnitSet i a
createScale :: InitScale a -> Scale a
createUnitSet :: InitUnitSet i a -> UnitSet i a
showableUnit :: InitUnitSet i a -> Maybe (InitUnitSet i a)
powerOfUnitSet :: (Ord i, C a) => Int -> UnitSet i a -> UnitSet i a
Raise all scales of a unit and the unit itself to the n-th power
powerOfScale :: C a => Int -> Scale a -> Scale a
showExp :: Int -> String
positiveToFront :: [UnitSet i a] -> [UnitSet i a]
Reorder the unit components in a way that the units with positive exponents lead the list.
decompose :: (Ord i, C a) => T i -> T i a -> [UnitSet i a]
Decompose a complex unit into common ones
findIndep :: Eq i => T i -> T i a -> Maybe (UnitSet i a)
findClosest :: (Ord i, C a) => T i -> T i a -> UnitSet i a
evalDist
:: (Ord i, C a)
=> T i
-> T i a
-> [(UnitSet i a, Int)](UnitSet,distance) the UnitSet may contain powered units
findBestExp :: Ord i => T i -> T i -> (Int, Int)
findMinExp :: [(Int, Int)] -> (Int, Int)
Find the exponent that lead to minimal distance Since the list is infinite maximum will fail but the sequence is convex and thus we can abort when the distance stop falling
distLE :: (Int, Int) -> (Int, Int) -> Bool
distances :: Ord i => T i -> [(Int, T i)] -> [(Int, Int)]
listMultiples :: (T i -> T i) -> Int -> [(Int, T i)]
Produced by Haddock version 0.7