The

Whole Code

Catalog

Hazel

Reviewed July 24, 2019

While computer science theory normally analyzes complete and valid programs, the activity of programming consists mostly of incomplete and invalid programs. Hazel is an academic research project by Cyrus Omar that is providing mathematical foundations for incomplete and invalid programs with the aim of improving the experience of programming through improved developer tool services. For example, Hazel provides a semantics for partially evaluating incomplete and invalid expressions. The Hazel project also features an experimental structured editor with a focus on fluid editing and rich input types.

Live evaluation of incomplete terms

Evaluation continues around "empty holes". Unfinished terms are evaluated as far as they can be.

Type errors with live data

Type errors render as partially evaluated expressions with incompatible types being treated as "non-empty holes" and outlined in red.

Rich type input

The Hazel structured editor allows for various kinds of rich data (tables, inputs, pictures, JSON, etc). A former project of Cyrus's featured an IDE-embedded color picker and regex tester.

Fluid Structured Editing

Influenced by work of the mbeddr team, terms in Hazel can be constructed in any order (even from inside-out) and can be used before they are defined.

Collaboration

The Hazel project also features a semantics for editing programs, which makes merging code much more semantic than diffing lines of syntax. For example, a rename operation is semantically one operation, not seperate changes everywhere the name is referenced. They have modeled their code data structure as a CRDT which easily allows for Google-docs-style collaboration.

Further Reading