views:

121

answers:

1

The examples of functional dependencies I've seen boil down to mapping container -> element, and arguments -> result (as in Mult Matrix Vector Vector). They seem to be better expressed with type functions. In database theory, more complex relationships are considered that are not of this form (like a -> b, b -> a).

Are there examples of usage of FDs in Haskell that cannot be nicely written using type functions?

+2  A: 

As Manuel Chakravarty explains, type functions and functional dependencies have roughly the same expressiveness, you can translate one formulation into the other. They only begin to differ when you look at interaction with other language extensions like GADTs or UndecidableInstances. I gather that type families are currently favored for implementation in GHC because their interaction with GADTs and existential types is substantially simpler.

Heinrich Apfelmus