## Sound and Decidable Type Inference for Functional Dependencies (2004)

### Cached

### Download Links

- [research.microsoft.com]
- [www.cs.mu.oz.au]
- DBLP

### Other Repositories/Bibliography

Citations: | 34 - 14 self |

### BibTeX

@MISC{Duck04soundand,

author = {Gregory J. Duck and Simon Peyton-Jones and Peter J. Stuckey and Martin Sulzmann},

title = {Sound and Decidable Type Inference for Functional Dependencies},

year = {2004}

}

### Years of Citing Articles

### OpenURL

### Abstract

Functional dependencies are a popular and useful extension to Haskell style type classes. In this paper, we give a reformulation of functional dependencies in terms of Constraint Handling Rules (CHRs). In previous work, CHRs have been employed for describing user-programmable type extensions in the context of Haskell style type classes. Here, we make use of CHRs to provide for the first time a concise result that under some sufficient conditions, functional dependencies allow for sound and decidable type inference. The sucient conditions imposed on functional dependencies can be very limiting. We show how to safely relax these conditions.

### Citations

417 | Theory and practice of constraint handling rules
- Frühwirth
- 1998
(Show Context)
Citation Context ...onal conditions. 3 Functional Dependencies expressed using CHRs In this section we explain how to translate functional dependencies into a lowerlevel notation, called Constraint Handling Rules (CHRs) =-=[Frü98]-=-. This translation has two benefits: it allows us to give a more precise account of exactly what functional dependencies mean; and it allows us to formally verify that Jones’s conditions are sufficien... |

199 | Constraint handling rules - Frühwirth - 1995 |

162 | Type classes with functional dependencies
- Jones
- 2000
(Show Context)
Citation Context ...ence. The sufficient conditions imposed on functional dependencies can be very limiting. We show how to safely relax these conditions. 1 Introduction Functional dependencies, introduced by Mark Jones =-=[Jon00]-=-, have proved to be a very attractive extension to multi-parameter type classes in Haskell. For example, consider a class intended to describe a collection of type c containing values of type e: class... |

133 |
Qualified Types: Theory and Practice
- Jones
- 1994
(Show Context)
Citation Context ...ermore, they do not consider any extensions such as more liberal FDs. In [Jon95], Jones introduces a general theory of simplifying and improving types as a refinement of his theory of qualified types =-=[Jon92]-=-. However, he does not provide any formal results which improvement strategies lead to sound and decidable type inference. Subsequently, Jones extends multi-parameter type classes with functional depe... |

94 | Operational semantics and confluence of constraint propagation rules
- Abdennadher
- 1997
(Show Context)
Citation Context ...f terminating instance CHRs which we plan to pursue in future work. Note that, when a set of CHRs are terminating, we can easily test for confluence by checking that all “critical pairs” are joinable =-=[Abd97]-=-. Range restriction Range-restrictedness is the third condition we impose on CHRs. We say a CHR is range-restricted iff grounding all variables on the lefthand side of a CHR, grounds all variables on ... |

58 | A theory of overloading
- Stuckey, Sulzmann
(Show Context)
Citation Context ...hand side. Although not relevant to the content of this paper, the rule generated from the instance is also intimately connected to the evidence translation for the program above, we refer readers to =-=[SS02]-=- for more details. 3.1 Translation to CHRs Formalising the translation given above, class and instance declarations are translated into CHRs as follows: Definition 2 (CHR Translation). Consider a clas... |

53 | Simplifying and improving qualified types
- Jones
- 1995
(Show Context)
Citation Context ... dependency c->e expresses the idea that the collection type c fixes the element type e, and hence that e1 and e2 must be the same type. In such a situation, we commonly say that types are “improved” =-=[Jon95]-=-. Functional dependencies are useful in many different contexts. Here are some representative examples. Example 2. Consider the following class for representing state monads and two instancessclass SM... |

39 |
Parametric Type Classes
- Chen, Hudak, et al.
- 1992
(Show Context)
Citation Context ...>v2) where eval env (ExpAbs x exp) = \v -> eval (Cons (x,v) env) exp 5 Related Work The idea of improving types in the context of Haskell type classes is not new. For example, Chen, Hudak and Odersky =-=[CHO92]-=- introduce type classes which can be parameterized by a specific parameter. For example, the declaration class SM m r | m->r from Example 2 can be expressed as the parametric declaration class m::SM r... |

37 | Boxes go bananas: Encoding higherorder abstract syntax with parametric polymorphism - Washburn, Weirich |

34 |
et al., “Report on the programming language haskell 98,” tech
- Jones, Hughes, et al.
- 1999
(Show Context)
Citation Context ...hrough the FD. For the purpose of this paper, we generally assume that instance CHRs are terminating. There exists some sufficient criteria to ensure that instance CHRs are terminating, e.g. consider =-=[Pey99]-=-. Clearly, we can possibly identify further classes of terminating instance CHRs which we plan to pursue in future work. Note that, when a set of CHRs are terminating, we can easily test for confluenc... |

12 | Operational semantics and con of constraint propagation rules - Abdennadher - 1997 |

11 |
Type-checking multi-parameter type classes
- Duggan, Ophel
(Show Context)
Citation Context ...s sufficient to ensure sound and decidable type inference. Surprisingly, he introduces Example 3 (which breaks the termination condition) as a motivation for functional dependencies.sDuggan and Ophel =-=[DO02]-=- describe an improvement strategy, domain-driven unifying overload resolution, which is very similar to functional dependencies. Indeed, they were the first to point out the potential problem of non-t... |

10 | Structure and interpretation of quantum mechanics — a functional framework - Karczmarczuk - 2003 |

5 | Simplifying and improving quali types - Jones - 1995 |

1 | Classy type analysis - Chakravarty, Keller - 2003 |