Practical Reflection and Metaprogramming for Dependent Types

David Raymond Christiansen

    Publikation: Bog / Antologi / Rapport / Ph.D.-afhandlingPh.d.-afhandling

    Abstract

    Embedded domain-specific languages are special-purpose programming languages that are implemented within existing generalpurpose programming languages. Dependent type systems allow strong invariants to be encoded in representations of domain-specific languages, but it can also make it difficult to program in these embedded languages. Interpreters and compilers must always take these invariants into account at each stage, and authors of embedded languages must work hard to relieve users of the burden of proving
    these properties.

    Idris is a dependently typed functional programming language whose semantics are given by elaboration to a core dependent type theory through a tactic language. This dissertation introduces elaborator reflection, in which the core operators of the elaborator are realized as a type of computations that are executed during the elaboration process of Idris itself, along with a rich API for reflection. Elaborator reflection allows domain-specific languages to be implemented using the same elaboration technology as Idris itself, and it
    gives them additional means of interacting with native Idris code. It also allows Idris to be used as its own metalanguage, making it into a programmable programming language and allowing code re-use across all three stages: elaboration, type checking, and execution.

    Beyond elaborator reflection, other forms of compile-time reflection have proven useful for embedded languages. This dissertation also describes error reflection, in which Idris code can rewrite DSL error messages before presenting domain-specific messages to users, as well as a means for integrating quasiquotation into a tactic-based elaborator so that high-level syntax can be used for low-level reflected terms.
    OriginalsprogEngelsk
    ForlagIT-Universitetet i København
    Antal sider182
    ISBN (Trykt)978-87-7949-338-4
    StatusUdgivet - 2016
    NavnITU-DS
    Nummer119
    ISSN1602-3536

    Fingeraftryk

    Dyk ned i forskningsemnerne om 'Practical Reflection and Metaprogramming for Dependent Types'. Sammen danner de et unikt fingeraftryk.

    Citationsformater