Confluence for non-full functional dependencies
Tom Schrijvers, Martin Sulzmann · Lirias (KU Leuven) · 2009
Previous work on type inference for functional dependencies demands that the dependency must fully cover all parameters of a type class to guarantee that the constraint solver is confluent. However, several interesting programs rely on non-full functional dependencies. For these, the underlying constraint is non-confluent, and hence type inference for these programs is possibly ill-behaved. We investigate two approaches to restore confluence for non-full FDs. In the first approach, we characterize a class of transformable non-full to full FD programs where the resulting full FD program is confluent. This approach has some inherent limitations due to the use of constraint simplification during type inference. In the second approach, we show how achieve confluence in general by applying a radically different type inference approach which favors constraint propagation over simplification. Our results provide new insights in type inference issues behind functional dependencies and help to clarify some of the on-going discussions about the possible adoption of functional dependencies in a future Haskell standard.