Safe Haskell | None |
---|---|

Language | Haskell98 |

Numeric values combined with abstract Physical Units

## Synopsis

- data T i a = Cons (T i) a
- quantity :: (Ord i, Enum i, C a) => [Int] -> a -> T i a
- fromScalarSingle :: a -> T i a
- isScalar :: T i a -> Bool
- lift :: (a -> b) -> T i a -> T i b
- lift2 :: Eq i => String -> (a -> b -> c) -> T i a -> T i b -> T i c
- lift2Maybe :: Eq i => (a -> b -> c) -> T i a -> T i b -> Maybe (T i c)
- lift2Gen :: Eq i => String -> (a -> b -> c) -> T i a -> T i b -> c
- errorUnitMismatch :: String -> a
- addMaybe :: (Eq i, C a) => T i a -> T i a -> Maybe (T i a)
- subMaybe :: (Eq i, C a) => T i a -> T i a -> Maybe (T i a)
- scale :: (Ord i, C a) => a -> T i a -> T i a
- ratPow :: C a => T Int -> T i a -> T i a
- ratPowMaybe :: C a => T Int -> T i a -> Maybe (T i a)
- fromRatio :: (C b, C a) => T a -> b

# Documentation

A Physics.Quantity.Value.T combines a numeric value with a physical unit.

## Instances

(Ord i, C a v) => C a (T i v) Source # | |

(Ord i, C a v) => C a (T i v) Source # | |

Defined in Number.Physical | |

C a v => C a (T i v) Source # | |

Defined in Number.Physical | |

Monad (T i) Source # | |

Functor (T i) Source # | |

Applicative (T a) Source # | |

Ord i => C (T i) Source # | |

(Eq i, Eq a) => Eq (T i a) Source # | |

(Ord i, Ord a) => Ord (T i a) Source # | |

(Ord i, Enum i, Show a) => Show (T i a) Source # | |

(Ord i, C a) => C (T i a) Source # | |

C v => C (T a v) Source # | |

(Ord i, C a) => C (T i a) Source # | |

(Ord i, C a) => C (T i a) Source # | |

(Ord i, C a) => C (T i a) Source # | |

(Ord i, C a) => C (T i a) Source # | |

(Ord i, C a) => C (T i a) Source # | |

Defined in Number.Physical exp :: T i a -> T i a Source # log :: T i a -> T i a Source # logBase :: T i a -> T i a -> T i a Source # (**) :: T i a -> T i a -> T i a Source # sin :: T i a -> T i a Source # cos :: T i a -> T i a Source # tan :: T i a -> T i a Source # asin :: T i a -> T i a Source # acos :: T i a -> T i a Source # atan :: T i a -> T i a Source # sinh :: T i a -> T i a Source # cosh :: T i a -> T i a Source # tanh :: T i a -> T i a Source # asinh :: T i a -> T i a Source # |

quantity :: (Ord i, Enum i, C a) => [Int] -> a -> T i a Source #

Construct a physical value from a numeric value and the full vector representation of a unit.

fromScalarSingle :: a -> T i a Source #

lift :: (a -> b) -> T i a -> T i b Source #

apply a function to the numeric value while preserving the unit

errorUnitMismatch :: String -> a Source #

addMaybe :: (Eq i, C a) => T i a -> T i a -> Maybe (T i a) Source #

Add two values if the units match, otherwise return Nothing