Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
For defining units built from a concept.
Synopsis
- class MayHaveUnit u where
- class (Idea u, Definition u, HasUnitSymbol u) => IsUnit u where
- class TempHasUnit u where
- data UnitDefn = UD {
- _vc :: ConceptChunk
- _cas :: UnitSymbol
- _cu :: [UID]
- makeDerU :: ConceptChunk -> UnitEquation -> UnitDefn
- newUnit :: String -> UnitEquation -> UnitDefn
- derUC :: String -> String -> String -> Symbol -> UDefn -> UnitDefn
- derUC' :: String -> String -> String -> Symbol -> UDefn -> UnitDefn
- derUC'' :: String -> NP -> String -> Symbol -> UDefn -> UnitDefn
- fund :: String -> String -> String -> UnitDefn
- fund' :: String -> String -> Symbol -> UnitDefn
- derCUC :: String -> String -> String -> Symbol -> UnitEquation -> UnitDefn
- derCUC' :: String -> String -> String -> Symbol -> UnitEquation -> UnitDefn
- derCUC'' :: String -> NP -> String -> Symbol -> UnitEquation -> UnitDefn
- unitWrapper :: IsUnit u => u -> UnitDefn
- (^:) :: UnitDefn -> Integer -> UnitEquation
- (/:) :: UnitDefn -> UnitDefn -> UnitEquation
- (*:) :: UnitDefn -> UnitDefn -> UnitEquation
- (*$) :: UnitDefn -> UnitEquation -> UnitEquation
- (/$) :: UnitDefn -> UnitEquation -> UnitEquation
- (^$) :: UnitEquation -> UnitEquation -> UnitEquation
- scale :: IsUnit s => Double -> s -> UDefn
- shift :: IsUnit s => Double -> s -> UDefn
- fromUDefn :: UDefn -> USymb
- unitCon :: String -> ConceptChunk
- getCu :: UnitEquation -> [UID]
- compUnitDefn :: UnitDefn -> UnitDefn -> Ordering
Classes
class MayHaveUnit u where Source #
Types may contain a unit (UnitDefn
).
Instances
class (Idea u, Definition u, HasUnitSymbol u) => IsUnit u where Source #
Units are Idea
s with a Definition
which store a unit symbol.
They must also be explicitly declared to be instances of IsUnit.
class TempHasUnit u where Source #
Temporary class to make sure chunks have a unit (in order to eventually get rid of MayHaveUnit
).
Instances
TempHasUnit UnitalChunk Source # | Finds the units used to make the |
Defined in Language.Drasil.Chunk.Unital findUnit :: UnitalChunk -> UnitDefn Source # |
Chunk Type
For defining units.
It has a ConceptChunk
(that defines what kind of unit it is),
a unit symbol, maybe another (when it is a synonym),
perhaps a definition, and a list of UID
of the units that make up
the definition.
Ex. Meter is a unit of length defined by the symbol (m).
UD | |
|
Instances
Idea UnitDefn Source # | Finds the idea contained in the |
NamedIdea UnitDefn Source # | Finds term ( |
ConceptDomain UnitDefn Source # | Finds the domain contained in the |
Definition UnitDefn Source # | Finds definition of the |
HasUnitSymbol UnitDefn Source # | Finds unit symbol of the |
IsUnit UnitDefn Source # | Gets the UnitDefn and contributing units. |
HasUID UnitDefn Source # | Finds |
Eq UnitDefn Source # | Equal if |
Constructors
makeDerU :: ConceptChunk -> UnitEquation -> UnitDefn Source #
Create a derived unit chunk from a concept and a unit equation.
newUnit :: String -> UnitEquation -> UnitDefn Source #
Smart constructor for new derived units from existing units.
unitWrapper :: IsUnit u => u -> UnitDefn Source #
Unit Combinators (UnitEquation
s)
(*$) :: UnitDefn -> UnitEquation -> UnitEquation Source #
Combinator for multiplying a unit and a symbol.
(/$) :: UnitDefn -> UnitEquation -> UnitEquation Source #
Combinator for dividing a unit and a symbol.
(^$) :: UnitEquation -> UnitEquation -> UnitEquation Source #
Combinator for mulitiplying two unit equations.
Unit Relation Functions
Helpers
unitCon :: String -> ConceptChunk Source #
Helper for fundamental unit concept chunk creation. Uses the same String
for the identifier, term, and definition.