Records

A variant of a custom type can hold other data within it. In this case the variant is called a record.

The fields of a record can be given labels, and like function argument labels they can be optionally used when calling the record constructor. Typically labels will be used for variants that define them.

It is common to have a custom type with one variant that holds data, this is the Gleam equivalent of a struct or object in other languages.

When defining custom types with one variant, the single variant is often named the same as the custom type, although it doesn't have to be.