Deconstraining DSLs

作者:Jones Will*; Field Tony; Allwood Tristan
来源:ACM Sigplan Notices, 2012, 47(9): 298-308.
DOI:10.1145/2398856.2364571

摘要

Strongly-typed functional languages provide a powerful framework for embedding Domain-Specific Languages (DSLs). However, building type-safe functions defined over an embedded DSL can introduce application-specific type constraints that end up being imposed on the DSL data types themselves. At best, these constraints are unwieldy and at worst they can limit the range of DSL expressions that can be built. We present a simple solution to this problem that allows application-specific constraints to be specified at the point of use of a DSL expression rather than when the DSL's embedding types are defined. Our solution applies equally to both tagged and tagless representations and, importantly, also works in the presence of higher-rank types.

  • 出版日期2012-9

全文