[Haskell-cafe] Fundeps and overlapping instances

Simon Peyton-Jones simonpj at microsoft.com
Mon Jun 4 13:35:46 CEST 2012


| > My take is that we should abandon Fundeps, and concentrate on
| > introducing overlaps into type functions in a controlled way (what
| > I've called 'dis- overlapped overlaps'.)
| 
| Abandoning fundeps would be a sad day for type-level programming.
| There are many things other than overlaps that you can do with fundeps
| and constraint kinds that you cannot currently do with type families,
| such as:
| 
| - Partial application or higher-order programming.
| - Short-circuit evaluation, lazy evaluation or type-level case.

Etienne, I think it would be a good service to make Haskell wiki page describing the difference between fundeps and type families, and in particular describing things that can be done with the former but not the latter.

The standard encoding of fundeps using type families is this:

With fundeps
	class C a b | a -> b
With type failies
	class (F a ~ b) => C a b where
        type F a

The merit of a wiki page would be to be a single place to find the discussion, the "standard encoding" and examples of where the standard encoding fails.

Simon


More information about the Haskell-Cafe mailing list