[Haskell-cafe] CRIP: the Curiously Reoccuring Instance Pattern

oleg at okmij.org oleg at okmij.org
Fri Aug 3 09:47:00 CEST 2012


> I think instead you should have:
> - abandoned FunDeps
> - embraced Overlapping more!

Well, using TypeCast to emulate all FunDeps was demonstrated three
years later after HList (or even sooner -- I don't remember when
exactly the code was written):

http://okmij.org/ftp/Haskell/TypeClass.html#Haskell1

    We demonstrate that removing from Haskell the ability to define typeclasses
    leads to no loss of expressivity. Haskell restricted to a single,
    pre-defined typeclass with only one method can express all of Haskell98
    typeclass programming idioms including constructor classes, as well as
    multi-parameter type classes and even some functional dependencies. The
    addition of TypeCast as a pre-defined constraint gives us all functional
    dependencies, bounded existentials, and even associated data types. Besides
    clarifying the role of typeclasses as method bundles, we propose a simpler
    model of overloading resolution than that of Hall et al.


> So here's my conjecture:
> 1. We don't need FunDeps, except to define TypeCast.
>    (And GHC now has equality constraints, which are prettier.)
> 2. Without FunDeps, overlapping works fine.
> ...

I agree on point 1 but not on point 2. The example of incoherence
described in Sec `7.6.3.4. Overlapping instances' of the GHC User
Guide has nothing to do with functional dependencies.






More information about the Haskell-Cafe mailing list