Type inference, Haskell and dependent types
This thesis studies questions of type inference, unification and elaboration for languages that combine dependent type theory and functional programming. Languages such as modern Haskell have very expressive type systems, allowing the programmer a great deal of freedom. These require advanced type i...
Main Author: | |
---|---|
Published: |
University of Strathclyde
2013
|
Subjects: | |
Online Access: | http://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.605927 |
id |
ndltd-bl.uk-oai-ethos.bl.uk-605927 |
---|---|
record_format |
oai_dc |
spelling |
ndltd-bl.uk-oai-ethos.bl.uk-6059272015-12-03T03:52:40ZType inference, Haskell and dependent typesGundry, Adam Michael2013This thesis studies questions of type inference, unification and elaboration for languages that combine dependent type theory and functional programming. Languages such as modern Haskell have very expressive type systems, allowing the programmer a great deal of freedom. These require advanced type inference and unification algorithms to reconstruct details that were left implicit, and suitable representation of the evidence delivered by such algorithms. The first part proposes an approach to unification and type inference, based on information increase in dependency-ordered contexts, and keeping careful track of variable scope. Two existing systems are reviewed: the Hindley-Milner type system, and units of measure in the style of Kennedy. Subtle issues relating to let-generalisation become clearer as a result. Using the same approach, an algorithm is described for Miller pattern unification in a full-spectrum dependent type theory, forming a foundation for the elaboration of dependently typed languages. The second part introduces inch, a language that extends Haskell with typelevel data and functions, and dependent product types. Type-level numbers and arithmetic operations are specifically considered, as a particularly useful source of applications, such as the perennial example of vectors (length-indexed lists). The increased expressivity in the source language is matched by a suitable core language of evidence, into which inch programs can be translated. This language is based on System FC, the existing core language used by GHC, adapted to clarify the relationships between the type and term levels. It gives a coherent operational semantics to both levels, allowing shared data and dependent functions, but retaining a clear phase distinction. The contextual approach of the first part of the thesis is used to specify the elaboration of inch into the evidence language, and applications of inch based on type-level arithmetic are demonstrated.004University of Strathclydehttp://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.605927http://oleg.lib.strath.ac.uk:80/R/?func=dbin-jump-full&object_id=22728Electronic Thesis or Dissertation |
collection |
NDLTD |
sources |
NDLTD |
topic |
004 |
spellingShingle |
004 Gundry, Adam Michael Type inference, Haskell and dependent types |
description |
This thesis studies questions of type inference, unification and elaboration for languages that combine dependent type theory and functional programming. Languages such as modern Haskell have very expressive type systems, allowing the programmer a great deal of freedom. These require advanced type inference and unification algorithms to reconstruct details that were left implicit, and suitable representation of the evidence delivered by such algorithms. The first part proposes an approach to unification and type inference, based on information increase in dependency-ordered contexts, and keeping careful track of variable scope. Two existing systems are reviewed: the Hindley-Milner type system, and units of measure in the style of Kennedy. Subtle issues relating to let-generalisation become clearer as a result. Using the same approach, an algorithm is described for Miller pattern unification in a full-spectrum dependent type theory, forming a foundation for the elaboration of dependently typed languages. The second part introduces inch, a language that extends Haskell with typelevel data and functions, and dependent product types. Type-level numbers and arithmetic operations are specifically considered, as a particularly useful source of applications, such as the perennial example of vectors (length-indexed lists). The increased expressivity in the source language is matched by a suitable core language of evidence, into which inch programs can be translated. This language is based on System FC, the existing core language used by GHC, adapted to clarify the relationships between the type and term levels. It gives a coherent operational semantics to both levels, allowing shared data and dependent functions, but retaining a clear phase distinction. The contextual approach of the first part of the thesis is used to specify the elaboration of inch into the evidence language, and applications of inch based on type-level arithmetic are demonstrated. |
author |
Gundry, Adam Michael |
author_facet |
Gundry, Adam Michael |
author_sort |
Gundry, Adam Michael |
title |
Type inference, Haskell and dependent types |
title_short |
Type inference, Haskell and dependent types |
title_full |
Type inference, Haskell and dependent types |
title_fullStr |
Type inference, Haskell and dependent types |
title_full_unstemmed |
Type inference, Haskell and dependent types |
title_sort |
type inference, haskell and dependent types |
publisher |
University of Strathclyde |
publishDate |
2013 |
url |
http://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.605927 |
work_keys_str_mv |
AT gundryadammichael typeinferencehaskellanddependenttypes |
_version_ |
1718143113604628480 |