#author("2019-11-23T01:13:14+00:00","default:sagasite","sagasite")
[[Program]] > [[JavaScript]] > [[AltJS]] > [[Elm]] > [[Elmガイド>Elm_guide]] > [[エラーハンドリング>Elm_guide_Error-Handling]] > Maybe

#norelated
#contents

//----------------------------------------
*Maybe [#s2dfeb9e]
-Maybe · An Introduction to Elm https://guide.elm-lang.jp/error_handling/maybe.html

Maybe型の定義
#code(haskell){{
type Maybe a
  = Just a
  | Nothing
}}

>Maybeは2つのバリアントを持つ型です。
つまり何も持っていない(=Nothing)か、ちょうど(=Just)1つの値を持っているか、です。
Maybe aの型変数は具体的な値次第でMaybe FloatやMaybe Stringといった型を持つことを可能にします。

>Maybeには主に2つの使いみちがあります。部分関数と入力が任意のフィールドで役立ちます。

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS