Skip to content

Latest commit

 

History

History
86 lines (46 loc) · 1.92 KB

moyo_monad.md

File metadata and controls

86 lines (46 loc) · 1.92 KB

Module moyo_monad

モナドに関する処理を集めたユーティリティモジュール.

Copyright (c) 2013-2014 DWANGO Co., Ltd. All Rights Reserved.

Data Types


maybe() = {just, term()} | nothing

なにか or Nothing を格納するデータ構造


maybe_fun() = {just, function()} | nothing

何らかの関数 or Nothing を格納するデータ構造

Function Index

apply_maybe/3MaybeFunが{just, Function}なら apply(Function, ArgList) を実行します.
maybe/1maybe()を作ります.
maybe_fun/1maybe()を作ります.

Function Details

apply_maybe/3


apply_maybe(MaybeFun::maybe_fun(), ArgList::[any()], DefaultValue::any()) -> any()

MaybeFunが{just, Function}なら apply(Function, ArgList) を実行します. MaybeFunがnothingならDefaultValue を返します

maybe/1


maybe(Value::term()) -> maybe()

maybe()を作ります.

{just nothing} は作れないので直接作ってください.

maybe_fun/1


maybe_fun(Fun::nothing | function()) -> maybe()

maybe()を作ります.