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