Option module

Values in Gleam are not nullable, so the gleam/option standard library module defines Gleam's Option type, which can be used to represent a value that is either present or absent.

Gleam では値は nullable ではありません。そのため gleam/option 標準ライブラリモジュールは Gleam の Option 型を定義しています。

The option type is very similar to the result type, but it does not have an error value. Some languages have functions return an option when there is no extra error detail to give, but Gleam always uses result. This makes all fallible functions consistent and removes any boilerplate that would be required when mixing functions that use each type.

Option 型は Result 型とよく似ていますが、エラー値を持ちません。いくつかの言語では、エラーの詳細がない場合、関数はオプションを返しますが、Gleam では常に Result を使用します。これにより、失敗しうる全ての関数に一貫性を持たせることができ、それぞれの型を使用する関数を混在させる際に必要となる定型文を取り除くことができます。