GADTs and functional dependencies

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Wed Sep 24 13:00:59 EDT 2008


Hello Simon,

thank you for your extensive answer!

I think, I’ll try to work around the fundep deficiencies and if that doesn’t 
work, switch to type families.

But your answer raised further questions/comments:

>         class (F a ~ b) => C a b
>           type family F a
>
> (Note for 6.10 users: type equalities in superclasses is the piece we still
> have not implemented.)

Do you mean type equalities like the one in the example above?  Didn’t this 
already work in 6.8.2?

> Almost all fundep programs can be translated in this way.  (Maybe all, I'm
> not 100% certain.)

Not all, I’m afraid.  There was a mailing list discussion between us several 
months ago where we talked about this.  The translation from fundeps to type 
families doesn’t work as soon as overlapping instances are involved.  The 
type equality check from HList is an example for this.  You told me that such 
a check can be implemented with type families as soon as we have closed TFs:

    type family TypeEq t1 t2 :: * where

        TypeEq t t = True
        TypeEq t1 t2 = False

Greetings to Victoria! (from Cottbus)
Wolfgang


More information about the Glasgow-haskell-users mailing list