uom-plugin-0.3.0.0: Units of measure as a GHC typechecker plugin

Safe HaskellNone
LanguageHaskell2010

Data.UnitsOfMeasure.Read

Contents

Description

Very very rough support for reading units of measure in the syntax used by Data.UnitsOfMeasure.Show.

Synopsis

Documentation

readQuantity :: Read a => String -> Either String (Some (QuantityWithUnit a)) Source #

Parse a quantity along with its units.

readUnit :: String -> Either String (Some SUnit) Source #

Parse a unit.

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.

data Some p where Source #

An existential wrapper type: Some p is essentially exists x . p x.

Constructors

Some :: p x -> Some p 

data QuantityWithUnit a u where Source #

Represents a quantity whose units have a syntactic representation that is known statically and at runtime.

Constructors

QuantityWithUnit :: Quantity a (Pack u) -> SUnit u -> QuantityWithUnit a u 

Orphan instances