Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 1 Nov 2026. What's built · Install 0.2.0
jadpo
Reference: Standard library

Standard types

UnitQuantity

On this page

How much of something an order line or a stock count holds: a count of items, or an amount by mass, volume, length or area, never below 0. Shown 3, 2.5 kg.

Commerce and logistics; not ordered; since Jadpo 0.1.0.

Make one

Pick one of its variants and give its fields, UnitQuantity.each { count: ... }.

Variants

Variant Fields
each count: Int
mass amount: Mass
volume amount: Volume
length amount: Length
area amount: Area

Text, JSON and storage

It has no single text form, so text.from and text.parse don't take it. JSON sends an object of its variant's name, as tag, and the variant's fields.

JSON
{"tag":"each","count":3}
{"tag":"each","count":1200}
{"tag":"mass","amount":{"value":"2.5","unit":"kg"}}
{"tag":"volume","amount":{"value":"0.0015","unit":"cubic_metre"}}
{"tag":"length","amount":{"value":"12","unit":"metre"}}
{"tag":"area","amount":{"value":"20","unit":"sqm"}}

It is stored in 3 columns, each named for the field, _ and its suffix. This is {"tag":"volume","amount":{"value":"0.0015","unit":"cubic_metre"}}:

Column Type Holds
<field>_kind text 'volume'
<field>_count bigint NULL::bigint
<field>_amount numeric(38, 9) 0.0015

Shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb:

Value Shown
{"tag":"each","count":3} 3
{"tag":"each","count":1200} 1,200
{"tag":"mass","amount":{"value":"2.5","unit":"kg"}} 2.5 kg
{"tag":"volume","amount":{"value":"0.0015","unit":"cubic_metre"}} 0.0015 m³
{"tag":"length","amount":{"value":"12","unit":"metre"}} 12 m
{"tag":"area","amount":{"value":"20","unit":"sqm"}} 20 m²

Operations

It has the contract's own operations: text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.

Markdown for agents: /docs/types/type-unit-quantity.md.Built from Jadpo main at e00e61f.