Functional Dependencies
In Haskell, type classes have been refined to allow the programmer to declare functional dependencies between type parameters—a concept inspired from relational database theory. That is, the programmer can assert that a given assignment of some subset of the type parameters uniquely determines the remaining type parameters. For example, general monads m
which carry a state parameter of type s
satisfy the type class constraint MonadState s m
. In this constraint, there is a functional dependency m -> s
. This means that for a given monad, the state type accessible from this interface is uniquely determined. This aids the compiler in type inference, as well as aiding the programmer in type-directed programming.
Simon Peyton-Jones has objected to the introduction of functional dependencies in Haskell on grounds of complexity.
Read more about this topic: Type Class
Famous quotes containing the word functional:
“In short, the building becomes a theatrical demonstration of its functional ideal. In this romanticism, High-Tech architecture is, of course, no different in spiritif totally different in formfrom all the romantic architecture of the past.”
—Dan Cruickshank (b. 1949)