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

AntC anthony_clayden at clear.net.nz
Wed Aug 1 00:30:53 CEST 2012


 <oleg <at> okmij.org> writes:

> 
> [... snip]
> 
> Of course instances above are overlapping. And when we add functional
> dependencies (since we really want type-functions rather type
> relations), they stop working at all. We had to employ work-arounds,
> which are described in detail in the HList paper (which is 8 years old
> already).
> 
Yes, it's adding the FunDeps that puts the spanner in the works.

Oleg, did you see this, and the discussion around that time?
http://www.haskell.org/pipermail/haskell-prime/2012-May/003688.html

I implemented hDeleteMany without FunDeps -- and it works in Hugs (using 
TypeCast -- but looks prettier in GHC with equality constraints).

Essentially it's a FunDep-like mechanism without FunDeps (as SPJ calls it), to 
achieve what Ryan's talking about. But you are quite right that we still need 
overlapping instances for parts of the type-level logic.

AntC





More information about the Haskell-Cafe mailing list