The Macaw logo, a scarlet macaw in flight

macaw_units

This software is a very early release, and not ready for general use.

Public home: github.com/dcoai/macaw_units · Docs: hexdocs.pm

Units as meaning for the Macaw family: macaw's layer over ucum, currencies, and the quantities' facts (spec/00). It depends on ucum and macaw_base only, so macaw_data and macaw_draw share one vocabulary of units without either depending on the other (dco-tek/macaw/macaw#478).

Module What it is
Macaw.Units.Unit UCUM codes read through ucum with macaw's stricter rules: parse/1, valid?/1, dimension/1, factor/1, kind/1, symbol/2, format_error/1 (spec/01 §1, §2, §4); currency/1 and minor_units/1 over the ISO 4217 table (§3); exact conversion/2 and convert/2,3 (§5)
Macaw.Units.Quantity the fixed list of quantities: all/0, of_unit/1, resolve/1, base_unit/1 (spec/01 §6); kind/1, bounds/1,2 (§7); additivity/2 (§8)
Macaw.Units.Error what every ! twin raises: its value twin's reason, worded by macaw_base's Macaw.Base.Fault.sentence/2 with units' words (spec/00 §3)

Presentation is not here: a person's typed symbols, a quantity's display families, unit systems and label are macaw_format's.

Installation

Two runtime dependencies, ucum and macaw_base. From Hex:

{:macaw_units, "~> 0.1.0"}

Part of Macaw.

License

MIT; see the LICENSE file.