Skip to content

Instantly share code, notes, and snippets.

@craigfe
Created February 25, 2022 11:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigfe/b0f7c65534a90ed4db9ad9ca129b2ed4 to your computer and use it in GitHub Desktop.
Save craigfe/b0f7c65534a90ed4db9ad9ca129b2ed4 to your computer and use it in GitHub Desktop.
Simple script for expanding OCaml PPXes (in a readable way)
#!/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"
dune build @check
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