Syntax

Kind

Construction

enum

An enum represents a value that may be one of a fixed set of named variants. Enums are useful for modeling mutually exclusive states, tagged values, and sum types in a clear and type-safe way.

Syntax

Enums are defined by declaring a set of named variants, each of which is an atom.

<color> := red | green | blue

When parsed and rendered, this code will appear as:

<color>:=red|green|blue

Kind

The kind of an enum value is the enum kind itself. For example:

<color>

Construction

Enum values are constructed by selecting a variant name, optionally providing a value if the variant carries data.

<color>:=red|green|bluec<color>:=:color/red