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