This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
7
unikernel/duniverse/lwt/test/ppx_let/dune
Normal file
7
unikernel/duniverse/lwt/test/ppx_let/dune
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(test
|
||||
(name test)
|
||||
(package lwt_ppx__ppx_let_tests)
|
||||
(build_if %{lib-available:ppx_let})
|
||||
(preprocess
|
||||
(pps ppx_let))
|
||||
(libraries lwt lwt.unix))
|
||||
27
unikernel/duniverse/lwt/test/ppx_let/test.ml
Normal file
27
unikernel/duniverse/lwt/test/ppx_let/test.ml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
let () =
|
||||
let p1 =
|
||||
let open Lwt.Let_syntax in
|
||||
let%bind x = Lwt.return 1 in
|
||||
let%map y = Lwt.return (x + 1) in
|
||||
y + 1
|
||||
in
|
||||
|
||||
let p2 =
|
||||
let open Lwt_result.Let_syntax in
|
||||
let%bind x = Lwt_result.return 2 in
|
||||
let%map y = Lwt_result.return (x + 3) in
|
||||
x + y
|
||||
in
|
||||
|
||||
let p =
|
||||
let%bind.Lwt p1 = p1 in
|
||||
let%map.Lwt_result p2 = p2 in
|
||||
p1 + p2
|
||||
in
|
||||
|
||||
let x = Lwt_main.run p in
|
||||
|
||||
if x = Ok 10 then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue