let-if

A let%if syntax inspired by Rust's if let syntax
README

This ppx adds a construct similar to if let in Rust.
The following two snippets are equivalent:

let%if Some x = Sys.getenv_opt "HELLO" in
print_endline x
match Sys.getenv_opt "HELLO" with
| Some x -> print_endline x
| _ -> ()

New: if%true then do

Do you often want to perform side effects if an expression is true while still returning the boolean value?
Then if%true is for you!
Simply write:

if%true cond then something else otherwise

... and your code is automagically transformed into:

let c = cond in (if c then something else otherwise); c

The else branch is optional!

Install
Published
14 Mar 2022
Sources
let-if-0.3.0.tbz
sha256=eda75b5c3285864f90f06c96a69154b235944207442bb8aa6282c0e032619fa1
sha512=db4c238dd1492632bbce060bab8c99ee5819e968dd6e22eca043ee972a6132e63419e3a987fe0a7e0f5ca60614c01b1872f332d46823920f3693928942c56f06
Dependencies
Reverse Dependencies