Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A 'Melange' of Tooling

A 'Melange' of Tooling

Melange is a new compiler for OCaml targeting JavaScript. Melange codebases integrate with the OCaml Platform: install from OPAM, build with Dune, preprocess with `ppxlib`, format with OCamlformat and publish with `dune-release`. Merlin, OCaml-LSP and `odoc` work out of the box.
In this talk, I will tell you about the Melange success story and give a glimpse of what's coming in the near future.

António Monteiro

September 17, 2024
Tweet

More Decks by António Monteiro

Other Decks in Programming

Transcript

  1. We need tools that do their job, but allow us

    to do ours Simplicity doesn’t exclude power
  2. (melange.emit (target artifact-directory) (promote (until-clean)) (alias my-js) ;; dune build

    @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  3. (target artifact-directory) (melange.emit (promote (until-clean)) (alias my-js) ;; dune build

    @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  4. (promote (until-clean)) (melange.emit (target artifact-directory) (alias my-js) ;; dune build

    @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  5. (alias my-js) ;; dune build @my-js (melange.emit (target artifact-directory) (promote

    (until-clean)) (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  6. (libraries reason-react) (melange.emit (target artifact-directory) (promote (until-clean)) (alias my-js) ;;

    dune build @my-js (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  7. (preprocess melange.ppx reason-react-ppx) (melange.emit (target artifact-directory) (promote (until-clean)) (alias my-js)

    ;; dune build @my-js (libraries reason-react) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  8. (compile_flags :standard --mel-cross-module-opt) (melange.emit (target artifact-directory) (promote (until-clean)) (alias my-js)

    ;; dune build @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  9. (module_systems (es6 .mjs)) (melange.emit (target artifact-directory) (promote (until-clean)) (alias my-js)

    ;; dune build @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public)))
  10. (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public))) (melange.emit (target artifact-directory) (promote

    (until-clean)) (alias my-js) ;; dune build @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs))
  11. (melange.emit (target artifact-directory) (promote (until-clean)) (alias my-js) ;; dune build

    @my-js (libraries reason-react) (preprocess melange.ppx reason-react-ppx) (compile_flags :standard --mel-cross-module-opt) (module_systems (es6 .mjs)) (runtime_deps ./styles.css (glob_files_rec ./resources/*.{png,js}) (source_tree ./public))) Simple, yet powerful
  12. Share Examples GitHub OPAM Melange 4.0.0-52 OCaml 5.2.0 Reason 3.12.0

    ReasonReact 0.15.0 OCaml Reason Format Problems No problems! Live JavaScript output This div has the ID selector preview . Choose "React Greetings" in the Examples menu to see it in action, or override by rendering into the element with ReactDOM.querySelector("#preview") Console 0 Loading...
  13. Share Examples GitHub OPAM Melange 4.0.0-52 OCaml 5.2.0 Reason 3.12.0

    ReasonReact 0.15.0 OCaml Reason Format Problems No problems! Live JavaScript output Console 0 Loading... Loading...
  14. Share Examples GitHub OPAM Melange 4.0.0-52 OCaml 5.2.0 Reason 3.12.0

    ReasonReact 0.15.0 OCaml Reason Format Problems No problems! Live JavaScript output Console 0 Loading... Loading...
  15. That I want to use 1. Build simple tools 2.

    Invert from user needs 3. Work with cool, talented people