Safe Haskell | None |
---|---|
Language | Haskell2010 |
Very very rough support for reading units of measure in the syntax used by Data.UnitsOfMeasure.Show.
- readQuantity :: Read a => String -> Either String (Some (QuantityWithUnit a))
- readUnit :: String -> Either String (Some SUnit)
- readWithUnit :: forall proxy a u. (Read a, KnownUnit u) => proxy u -> String -> Either String (Quantity a (Pack u))
- data Some p where
- data QuantityWithUnit a u where
- QuantityWithUnit :: Quantity a (Pack u) -> SUnit u -> QuantityWithUnit a u
Documentation
readQuantity :: Read a => String -> Either String (Some (QuantityWithUnit a)) Source #
Parse a quantity along with its units.
readWithUnit :: forall proxy a u. (Read a, KnownUnit u) => proxy u -> String -> Either String (Quantity a (Pack u)) Source #
Parse a quantity and check that it has the expected units.
An existential wrapper type:
is essentially Some
pexists x . p x
.
data QuantityWithUnit a u where Source #
Represents a quantity whose units have a syntactic representation that is known statically and at runtime.
QuantityWithUnit :: Quantity a (Pack u) -> SUnit u -> QuantityWithUnit a u |