Skip to content

Instantly share code, notes, and snippets.

@mseri
Forked from Khady/ppxed-source
Created September 10, 2019 06:59
Show Gist options
  • Save mseri/b46e09886a5cad9e3f73aaf337b9f418 to your computer and use it in GitHub Desktop.
Save mseri/b46e09886a5cad9e3f73aaf337b9f418 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