ocaml-monadic
ocaml-monadic copied to clipboard
When [%guard] does not expand, error message could be better
In this library, the extension [%guard] must appear as the first operand of the operator ;. If it appears anywhere else, it does not get processed. This is fine, but the extension is currently ignored in that case and the resulting error message from the OCaml compiler is not very helpful. Investigate improving the error message for this case.
Maybe it would be useful to catch all guard instances but replace any other than the "right" ones with [%ocaml.error "a guard is not allowed in this context"] or something similar.
That kind of error message would honestly be useful in lots of ppxs using extension points...