flyt

01 — The language

Every case handled. Every bound checked. Every fn pure.

In Go// an interface, a struct per case, a type switch
shop/domain.flyt
// How an order is paid.
enum Payment {
  Card { last4: String<min: 4, max: 4> }
  Invoice { days: Int<min: 0, max: 60> }
}
shop/rules.flyt
// What the receipt says of a payment.
fn describe(payment: Payment) -> String<max: 64> {
  match payment {
    Card { last4 } -> "Card ending {last4}"
    Invoice { days } -> "Invoice, due in {days} days"
  }
}