Custom types
Gleam has a few built in types such as Int
and
String
, but custom types allow the creation of entirely new
types.
A custom type is defined with the type
keyword followed by the
name of the type and a constructor for each variant of the type. Both
the type name and the names of the constructors start with uppercase letters.
Custom type variants can be pattern matched on using a case expression.