Hazel is a live functional-programming environment rooted in the principles of type theory. You can find the relevant papers and more motivation at the Hazel website.
Building and Running Hazel
If you already have
ocaml version 4.08.1 and least version 2.0 of
installed, you can build Hazel by running the following commands.
git clone firstname.lastname@example.org:hazelgrove/hazel.git
To run Hazel, run the command
make echo-html, which will print a filename.
Then use your preferred browser to open that file. For convenience, the
following make targets open the corresponding browser or invoke the
corresponding command immediately (see INSTALL.md):
If you are unfamiliar with
opam, do not have them installed, or
just get stuck, we recommend you follow the step-by-step installation
instructions contained in INSTALL.md.
From OCaml to ReasonML
This link lets you type OCaml and see what the corresponding ReasonML syntax is: https://reasonml.github.io/en/try.
This is useful if you are trying to figure out the ReasonML syntax for something that you know the OCaml syntax for.
Suggested Extensions for VS Code
Most of our team uses VisualStudio Code to write code. If you use VS Code, here are a few extensions that might be helpful.
These extensions provide support for editing ReasonML and Dune source code:
Due to Reason's poor parse errors, unbalanced parentheses can be difficult to find. The following extensions help with that.
Build System Details
Hazel is implemented in Reason (a dialect of OCaml) and is compiled to
make targets are provided as a convenience, they mostly translate to
make by itself is equivalent to invoking
make dev. With these
commands we pass additional flags to
js_of_ocaml that cause the insertion of
comments that map locations in the generated JS to locations in the source
files. This is useful for debugging purposes.
make dev also auto-formats Reason source files using
refmt (this is what the
@src/fmt alias is for). This ensures code from all contributors follows the
make dev and
make release commands do three things:
- Generate some internal parsers using
- Compile the Reason code to OCaml bytecode using the OCaml compiler.
You can print to the browser console using the standard
print_endline function. This is probably the easiest method right now.
js_of_ocaml does support source maps and has some other flags that might be useful. If you experiment with those and get them to work, please update this README with some notes.
You can run all of the unit tests located in
src/hazelcore/test by running
If the inline test runner causes problems for you, you can likely resolve the issue by running
opam update then