Generic constraints for type-safe embedded programming

Domain-specific languages (DSLs) are everywhere, with applications in areas such as parser generation, music synthesis, parallel programming and even the design of domain-specific languages. However, while the pay-off in using a DSL may be substantial, the cost of introducing a language may be made...

Full description

Bibliographic Details
Main Author: Jones, Will
Other Authors: Field, Anthony ; Eisenbach, Susan
Published: Imperial College London 2013
Subjects:
004
Online Access:http://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.574039
id ndltd-bl.uk-oai-ethos.bl.uk-574039
record_format oai_dc
spelling ndltd-bl.uk-oai-ethos.bl.uk-5740392017-06-27T03:23:32ZGeneric constraints for type-safe embedded programmingJones, WillField, Anthony ; Eisenbach, Susan2013Domain-specific languages (DSLs) are everywhere, with applications in areas such as parser generation, music synthesis, parallel programming and even the design of domain-specific languages. However, while the pay-off in using a DSL may be substantial, the cost of introducing a language may be made prohibitively high by the need to construct a supporting toolchain. A common tactic is to embed a DSL into a general-purpose host programming language. Existing infrastructure such as a language’s compiler or type system may be re-used, provided that the embedding accurately captures the properties of the DSL. While the rich type systems and orthogonal abstraction features of modern functional languages have proved particularly capable in this regard, they are not without their shortcomings. 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. In this thesis we tackle the problem of accurately embedding a DSL’s type system into that of the purely functional language Haskell. We present a framework for expressing application-specific constraints at the point of a DSL expression’s use rather than when the DSL’s embedding is defined. We show how our framework can be applied more generally to capture arbitrary properties of a DSL expression and, in certain cases, how we may subsequently prove additional safety properties such as the totality of a function which operates over DSL expressions. We evaluate our techniques by illustrating their use in constructing a DSL for heterogeneous parallel programming. However, our methods have potentially wider applications such as context-dependent computation, which are also discussed.004Imperial College Londonhttp://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.574039http://hdl.handle.net/10044/1/11174Electronic Thesis or Dissertation
collection NDLTD
sources NDLTD
topic 004
spellingShingle 004
Jones, Will
Generic constraints for type-safe embedded programming
description Domain-specific languages (DSLs) are everywhere, with applications in areas such as parser generation, music synthesis, parallel programming and even the design of domain-specific languages. However, while the pay-off in using a DSL may be substantial, the cost of introducing a language may be made prohibitively high by the need to construct a supporting toolchain. A common tactic is to embed a DSL into a general-purpose host programming language. Existing infrastructure such as a language’s compiler or type system may be re-used, provided that the embedding accurately captures the properties of the DSL. While the rich type systems and orthogonal abstraction features of modern functional languages have proved particularly capable in this regard, they are not without their shortcomings. 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. In this thesis we tackle the problem of accurately embedding a DSL’s type system into that of the purely functional language Haskell. We present a framework for expressing application-specific constraints at the point of a DSL expression’s use rather than when the DSL’s embedding is defined. We show how our framework can be applied more generally to capture arbitrary properties of a DSL expression and, in certain cases, how we may subsequently prove additional safety properties such as the totality of a function which operates over DSL expressions. We evaluate our techniques by illustrating their use in constructing a DSL for heterogeneous parallel programming. However, our methods have potentially wider applications such as context-dependent computation, which are also discussed.
author2 Field, Anthony ; Eisenbach, Susan
author_facet Field, Anthony ; Eisenbach, Susan
Jones, Will
author Jones, Will
author_sort Jones, Will
title Generic constraints for type-safe embedded programming
title_short Generic constraints for type-safe embedded programming
title_full Generic constraints for type-safe embedded programming
title_fullStr Generic constraints for type-safe embedded programming
title_full_unstemmed Generic constraints for type-safe embedded programming
title_sort generic constraints for type-safe embedded programming
publisher Imperial College London
publishDate 2013
url http://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.574039
work_keys_str_mv AT joneswill genericconstraintsfortypesafeembeddedprogramming
_version_ 1718465468503687168