Types and Patterns

Donna has the usual everyday types:

Custom types use constructors.

code
pub type Status:
  Draft
  Published

Use case to branch on values.

code
fn status_label(status: Status) -> String:
  case status:
    Draft -> "draft"
    Published -> "published"

Constructors can carry values.

code
pub type Page:
  Home
  Article(title: String, slug: String)

Pattern matching lets each branch name the values it needs.

code
fn page_title(page: Page) -> String:
  case page:
    Home -> "Home"
    Article(title, _) -> title

Use custom types when the shape matters. A named type is often clearer than a clever tuple. Donna is practical, not cryptic.