Define and implement a generic monad behavior.
[hope.git] / src / hope_monad.erl
1 -module(hope_monad).
2
3 -type t(_A) ::
4 term().
5
6 -callback return(A) ->
7 t(A).
8
9 -callback map(t(A), fun((A) -> (B))) ->
10 t(B).
11
12 %% @doc "pipe" is equivalent to traditional "bind", in general use-case, but is
13 %% arguably more useful for composition in Erlang's syntactic setting.
14 %% @end
15 -callback pipe([fun((A) -> t(B))], A) ->
16 t(B).
This page took 0.060592 seconds and 4 git commands to generate.