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 language | English |
---|---|
Title of host publication | Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages |
Subtitle of host publication | IFL 2017 |
Publisher | Association for Computing Machinery |
ISBN (Print) | 9781450363433 |
DOIs | |
Publication status | Published - 30 Aug 2017 |