Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert 'Let.return ()' to 'Lwt.return_unit'. #288

Merged
merged 1 commit into from
Nov 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ppx/ppx_lwt_ex.ml
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,23 @@ let lwt_expression mapper exp attributes =
(** [while%lwt $cond$ do $body$ done] ≡
[let rec __ppx_lwt_loop () =
if $cond$ then Lwt.bind $body$ __ppx_lwt_loop
else Lwt.return ()
else Lwt.return_unit
in __ppx_lwt_loop]
*)
| Pexp_while (cond, body) ->
let new_exp =
[%expr
let rec __ppx_lwt_loop () =
if [%e cond] then Lwt.bind [%e body] __ppx_lwt_loop
else Lwt.return ()
else Lwt.return_unit
in __ppx_lwt_loop ()
]
in mapper.expr mapper { new_exp with pexp_attributes }

(** [for%lwt $p$ = $start$ (to|downto) $end$ do $body$ done] ≡
[let __ppx_lwt_bound = $end$ in
let rec __ppx_lwt_loop $p$ =
if $p$ COMP __ppx_lwt_bound then Lwt.return ()
if $p$ COMP __ppx_lwt_bound then Lwt.return_unit
else Lwt.bind $body$ (fun () -> __ppx_lwt_loop ($p$ OP 1))
in __ppx_lwt_loop $start$]
*)
Expand All @@ -192,7 +192,7 @@ let lwt_expression mapper exp attributes =
[%expr
let [%p pat_bound] : int = [%e bound] in
let rec __ppx_lwt_loop [%p p] =
if [%e comp] [%e p'] [%e exp_bound] then Lwt.return ()
if [%e comp] [%e p'] [%e exp_bound] then Lwt.return_unit
else Lwt.bind [%e body] (fun () -> __ppx_lwt_loop ([%e op] [%e p'] 1))
in __ppx_lwt_loop [%e start]
]
Expand Down