Skip to content

Instantly share code, notes, and snippets.

@Khady
Created September 9, 2019 06:46
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Khady/e7b197e60a5065651815bc7b19c07a24 to your computer and use it in GitHub Desktop.
Save Khady/e7b197e60a5065651815bc7b19c07a24 to your computer and use it in GitHub Desktop.
Use merlin to print an ocaml file after being processed by a ppx
#!/usr/bin/env sh
# A .merlin must be present nearby the file.
# With dune it can be generated by calling `dune build @check`.
FILE="$1"
ocamlmerlin single dump -what ppxed-source -filename "$FILE" < "$FILE" | jq -r '.value' | ocamlformat --name="$FILE" -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment