home
/
code
/
hope.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Change to a more consistent alignment style.
[hope.git]
/
src
/
hope_option.erl
1
-module(hope_option).
2
3
-export_type(
4
[ t/1
5
]).
6
7
-export(
8
[ put/2
9
, get/2
10
, map/2
11
]).
12
13
14
-type t(A) ::
15
none
16
| {some, A}
17
.
18
19
20
put(X, F) ->
21
case F(X)
22
of true -> {some, X}
23
; false -> none
24
end.
25
26
27
get({some, X}, _) -> X;
28
get(none , Y) -> Y.
29
30
31
map({some, X}, F) -> {some, F(X)};
32
map(none , _) -> none.
This page took
0.047171 seconds
and
4
git commands to generate.