| I think the implementation is some 90% complete though, in GHC head.
| Certainly you can write many associated types programs already -- the
| missing part is finishing off associated type synonyms, iirc.

...and we have a working implementation of that too, thanks to Tom
Schrijvers.  It's not in the HEAD yet, but it will be in a few weeks.

so it will be a part of 6.8? great news! afaiu, ATS, rather than AT,
is direct substitution for FD?

Functional dependencies desugar to indexed type families, an extension
of the original associated, in GHC head already. For the full story,
see the wiki page.

   http://haskell.org/haskellwiki/GHC/Indexed_types

which includes an example of porting functional dependencies to
associated types

   
http://haskell.org/haskellwiki/GHC/Indexed_types#A_associated_type_synonym_example

It's really simple to replace a functional dependency with a type function.

A class declaration

        class C a b | a -> b

becomes:

        class FD a ~ b => C a b where
          type FD a

and an instance

        instance C [x] x

becomes

        instance C [x] x where
          type FD [x] = x

That's it: only class and instance declarations have to be modified.

Now you can start to drop dependent parameters, if you want.

There are a few examples in my slides as well (if you don't mind the pptx): http://www.cs.kuleuven.be/~toms/Research/talks/Tyfuns.pptx

Cheers,

Tom

--
Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium

tel: +32 16 327544
e-mail: [EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to