Reading the (already impressive) compiled output in helper.bs.js
in the tutorial by Michele Riva on Calling ReasonML from TypeScript, I thought the output could be made nearly identical (bar comments and some weird nest paren wrapping) to what an experienced dev might write by hand
If we:
- have Flat-variants-(and polymorphic-variants)-as-strings (see
- Omit
String(x)
when x is already a string (already merged): rescript-lang/rescript#4293 - Propogate the variable names from destructuring a tuple to the output (see
ideal_output_2.bs.js
) - Don't do nested parens inside of
{j|$x foo $y bar $z baz|j}
output
Then the output (minus the /* tuple */
comments) would be exactly what you'd write by hand!