Thijs Alkemade avatar Thijs Alkemade committed e5435d7

Updated the README.

Increased the priorty of the half-unit binary operators. This is necessary to properly be able to mix |*| and *|, however, maybe priority 9 is a bit too high for such an operator...

Comments (0)

Files changed (2)

 UnitTyped is a Haskell library for type-safe calculations on numbers with units.
 
-It comes with all SI units and a large number of units derived from them, but it also makes it very easy to add new dimensions and units. It can give new definitions of *, /, +, -, ==, <, <=, > and >= to make notation as natural as possible. To define a new unit, only the multiplication factor and a string to display it is required. From just that, all other conversions can be inferred.
+It comes with all SI units and a large number of units derived from them, but it also makes it very easy to add new dimensions and units. It can give new definitions of `*`, `/`, `+`, `-`, `==`, `<`, `<=`, `>` and `>=` to make notation as natural as possible. To define a new unit, only the multiplication factor and a string to display it is required. From just that, all other conversions can be inferred.
 
 While it uses a large number of Haskell extensions, all units and dimensions are empty datatypes, so should not be a burden at runtime.
 
 Examples:
 
 	:::haskell
-		*Main> 1 meter + 35 centi meter
+		*Main> 1 *| meter |+| 35 *| centi meter
 		1.35 m
 
 coerce can be used to change from one unit to a different unit in the same dimension:
 
 	:::haskell
-		*Main> (120 kilo meter / hour) * 20 minute `as` mile
+		*Main> 120 *| kilo meter |/| hour |*| 20 *| minute `as` mile
 		24.854847689493358 mile
 
 See [the wiki][1] for more complicated examples.
 (|-|) :: (Fractional f, Convertible' a b, Convertible' c d, MapEq c a True) => Value f a b -> Value f c d -> Value f a b
 a |-| b = mkVal (val a - val (coerce b a))
 
-infixl 7 *|, |*, |/, /|
-infixl 6 +|, |+, -|, |-
+infixl 9 *|, |*, |/, /|
+infixl 8 +|, |+, -|, |-
 
 -- |Multiply a scalar by a unit.
 (*|) :: (Convertible' a b, Fractional f) => f -> Value f a b -> Value f a b
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.