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

Dose

On this page

An amount of a medicine, by mass or by volume, above nothing. Shown in milligrams or millilitres: 500 mg, 5 ml.

Health; not ordered; since Jadpo 0.1.0.

Make one

Pick one of its variants and give its fields, Dose.mass { amount: ... }.

Variants

Variant Fields
mass amount: Mass
volume amount: Volume

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":"mass","amount":{"value":"0.0005","unit":"kg"}}
{"tag":"mass","amount":{"value":"0.000000125","unit":"kg"}}
{"tag":"mass","amount":{"value":"0.001","unit":"kg"}}
{"tag":"volume","amount":{"value":"0.000005","unit":"cubic_metre"}}

It is stored in 2 columns, each named for the field, _ and its suffix. This is {"tag":"mass","amount":{"value":"0.001","unit":"kg"}}:

Column Type Holds
<field>_kind text 'mass'
<field>_amount numeric(38, 9) 0.001

Shown to people

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

With locale: Locale.en_gb:

Value Shown
{"tag":"mass","amount":{"value":"500","unit":"mg"}} 500 mg
{"tag":"mass","amount":{"value":"125","unit":"mcg"}} 0.125 mg
{"tag":"mass","amount":{"value":"1","unit":"g"}} 1,000 mg
{"tag":"volume","amount":{"value":"5","unit":"ml"}} 5 ml

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-dose.md.Built from Jadpo main at e00e61f.