a40629a1c52b58629b7a169dc8847c3f93bf83d0
[hope.git] / src / hope_result.erl
1 -module(hope_result).
2
3
4 -export_type(
5 [ t/2
6 ]).
7
8 -export(
9 [ pipe/2
10 ]).
11
12
13 -type t(A, B) ::
14 {ok, A}
15 | {error, B}
16 .
17
18
19 pipe([] , X) -> X;
20 pipe([F|Fs], X) ->
21 case F(X)
22 of {error, _}=E -> E
23 ; {ok, Y} -> pipe(Fs, Y)
24 end.
This page took 0.044435 seconds and 3 git commands to generate.