At a glance
Release v0.4.0
Una is a verification-first language for machine-generated software. Its design follows a few visible rules:
- A function is an equation. The header is the contract;
=separates it from the body, the implementation. @marks direct capability operations. Every direct interaction with the outside world goes through a capability written@name. A call performs the effects of the function it calls, which the caller'susescover, so a header lists everything its body may do.- Words over symbols:
and,or,not,implies,mod,if error fail. - One canonical form: significant indentation of 2 spaces, one formatter, and non-canonical source is an error.
- Nothing implicit. No exceptions, no null, no implicit conversions, no ambient authority, no shared mutable state.
una
module events.seating
pub kind Seats = Int in 0..5000
pub kind Availability = SoldOut | Few | Open
pub kind Event
name: Text
remaining: Seats
--- Availability bands for an event.
pub availability(e: Event) -> Availability
ensures e.remaining < 1 implies result is SoldOut
=
when e.remaining
in 0..0 -> SoldOut
in 1..<20 -> Few
in 20..5000 -> OpenThe compiler proves the ensures clause and that the three ranges cover every possible Seats value, before the program runs. The same package runs in the interpreter (una run) or compiles to a native executable (una build).