Type Error Customization in GHC: Controlling expression-level type errors by type-level programming

Alejandro Serrano, Jurriaan Hage

Research output: Chapter in Book/Report/Conference proceedingConference contribution

3 Citations (Scopus)

Abstract

Embedded domain specific languages (DSLs) are a common pattern in the functional programming world, providing very high-level abstractions to programmer. Unfortunately, this abstraction is broken when type errors occur, leaking details of the DSL implementation. In this paper we present a set of techniques for customizing type error diagnosis in order to avoid this leaking. These techniques have been implemented in the GHC Haskell compiler. Our customizations are declared in the type signatures of functions provided by the DSL, leading to type error message that are context-dependent: the same kind of error can be reported in a different way depending on the particular expression in which it occurs. We make use of the ability to manipulate constraints using type-level programming which is already present in GHC, and which enables reuse and abstraction of common type error patterns.
Original languageEnglish
Title of host publicationProceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages
Subtitle of host publicationIFL 2017
PublisherAssociation for Computing Machinery
ISBN (Print)9781450363433
DOIs
Publication statusPublished - 30 Aug 2017

Fingerprint

Dive into the research topics of 'Type Error Customization in GHC: Controlling expression-level type errors by type-level programming'. Together they form a unique fingerprint.

Cite this