Custom types

Gleam has a few built in types such as Int, String, but custom types allow the creation of entirely new types.

Gleam には、IntString などいくつかの組み込み型がありますが、カスタムタイプを使用すると、全く新しい型を作成できます。

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.

カスタムタイプは、type キーワードの後に型の名前と、型のバリアントごとのコンストラクタを付けて定義します。

Custom type variants can be pattern matched on using a case expression.

カスタムタイプのバリアントは、case 式を使用してパターンマッチさせることができます。