Skip to content

Commit 58e895d

Browse files
Fixed doc comments
1 parent cac275d commit 58e895d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Math/Haskellator/Internal/AstProcessingSteps/Evaluate.hs

+2
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ execVar n = getVarBinding n >>= \case
7676
return result
7777

7878
-- | Combine the Units of two Dimensions, by adding the powers of matching units.
79+
--
7980
-- >>> mergeUnits [UnitExp Meter 2, UnitExp Second 1, UnitExp Kilogram 1] [UnitExp Meter 1, UnitExp Second (-2)]
8081
-- m^3*kg/s
8182
mergeUnits :: Dimension -> Dimension -> Dimension
8283
mergeUnits lhs rhs = [x{power = power x + power y} | (x, y) <- pairs] ++ lr ++ rr
8384
where (pairs, (lr, rr)) = findPairs lhs rhs
8485

8586
-- | Combine the Units of two Dimensions, by subtracting the powers of matching units.
87+
--
8688
-- >>> subtractUnits [UnitExp Meter 2, UnitExp Second 1, UnitExp Kilogram 1] [UnitExp Meter 1, UnitExp Second (-2)]
8789
-- m*s^3*kg
8890
subtractUnits :: Dimension -> Dimension -> Dimension

src/Math/Haskellator/Internal/AstProcessingSteps/Normalize.hs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ normalize :: Expr -- ^ the 'Expr' tree to normalize
2020
normalize = Right . foldExpr (Val . filterMultiplier . convertDimensionToBase) BinOp UnaryOp Conversion VarBindings Var
2121

2222
-- | Converts a value to its base dimension
23+
--
2324
-- >>> convertDimensionToBase $ Value 1 [UnitExp Kilometer 2, UnitExp Hour 1]
2425
-- 3.6e9 m^2*s
2526
convertDimensionToBase :: AstValue -> AstValue
@@ -28,6 +29,7 @@ convertDimensionToBase (Value v u) = foldr doIt (Value v []) u
2829
in Value (v' * v'') (u'':u')
2930

3031
-- | Converts a value to a given dimension. Throws if the conversion is not possible.
32+
--
3133
-- >>> convertDimensionTo (Value 3600000000 [UnitExp Meter 2, UnitExp Second 1]) [UnitExp Kilometer 2, UnitExp Hour 1]
3234
-- 1.0 h*km^2
3335
convertDimensionTo :: AstValue -> Dimension -> AstValue

0 commit comments

Comments
 (0)