ocamlBetterErrors

v3.0.0
Better errors for ocaml

Before

Before

After

Glorious After

Before

Before

After

Glorious After

Work in progress!

npm install -g ocamlBetterErrors

Put this in your project's package.json:

{
  "scripts": {
    "start": "eval $(dependencyEnv) && nopam && which berror.native"
  },
  "dependencies": {
    "nopam": "*",
    "dependency-env": "*",
    "ocamlBetterErrors": "*"
  }
}

Running npm start with such configuration will expose the berror.native binary, for you to use like so:

ocamlc myApp.ml |& berror.native

Explanation: |& is a bash shortcut for 2>&1 | (not available in vanilla sh), which, in turn, means "pipe the stuff from stderr into stdout, then pipe it back into stdin of the next command". berror takes in this info and searches for errors to pretty-print back.

To format the output in Reason syntax, use berror --path-to-refmttype thePathToRefmttype (where refmttype is a binary exposed by Reason).

Have fun!

For Development

git clone this repo, cd into it, then run:

npm install
# to compile
npm start
# to test, currently broken
npm test
npm i ocamlBetterErrors

Metadata

  • Unknown
  • Whatever
  • chenglou
  • released 11/10/2017

Downloads