Visible to the public Hazelnut: a bidirectionally typed structure editor calculusConflict Detection Enabled

TitleHazelnut: a bidirectionally typed structure editor calculus
Publication TypeConference Paper
Year of Publication2017
AuthorsCyrus Omar, Ian Voysey, Michael Hilton, Jonathan Aldrich, Matthew Hammer
Conference NamePOPL 2017 Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
Date Published01/15/2017
PublisherACM New York, NY, USA ©2017
Conference LocationParis, France
ISBN NumberISBN: 978-1-4503-4660-3
KeywordsApr'17, bidirectional type systems, CMU, gradual typing, mechanized metatheory, structure editors
Abstract

Structure editors allow programmers to edit the tree structure of a program directly. This can have cognitive benefits, particularly for novice and end-user programmers. It also simplifies matters for tool designers, because they do not need to contend with malformed program text. This paper introduces Hazelnut, a structure editor based on a small bidirectionally typed lambda calculus extended with holes and a cursor. Hazelnut goes one step beyond syntactic well-formedness: its edit actions operate over statically meaningful incomplete terms. Naively, this would force the programmer to construct terms in a rigid "outside-in" manner. To avoid this problem, the action semantics automatically places terms assigned a type that is inconsistent with the expected type inside a hole. This meaningfully defers the type consistency check until the term inside the hole is finished. Hazelnut is not intended as an end-user tool itself. Instead, it serves as a foundational account of typed structure editing. To that end, we describe how Hazelnut's rich metatheory, which we have mechanized using the Agda proof assistant, serves as a guide when we extend the calculus to include binary sum types. We also discuss various interpretations of holes, and in so doing reveal connections with gradual typing and contextual modal type theory, the Curry-Howard interpretation of contextual modal logic. Finally, we discuss how Hazelnut's semantics lends itself to implementation as an event-based functional reactive program. Our simple reference implementation is written using js_of_ocaml.

DOI10.1145/3009837.3009900
Citation Keynode-34446

Other available formats:

Omar_Hazelnut_JA.pdf
AttachmentTaxonomyKindSize
Omar_Hazelnut_JA.pdfPDF document355.13 KBDownloadPreview
AttachmentSize
bytes