Class ATs Question

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sat Apr 29 01:43:41 EDT 2006


Ashley Yakeley:
> You can do two-way fundeps. Can these be done with associated types? For 
> instance:
> 
>    class HasSign u s | u -> s, s -> u where
>      unsignedToSigned :: u -> s
>      signedToUnsigned :: s -> u
> 
>    instance HasSign Word8 Int8 where
>      ...
> 
> It might not be a great loss if not.

All FD programs that fulfil the weak coverage condition (which for all
practical purposes is as good as all FD programs) can be translated to
AT programs using a fairly simple translation scheme, as I recently
realised (but I must say that it was Martin Sulzmann's AFD paper that
inspired me):

  http://www.cse.unsw.edu.au/~chak/haskell/BetterAssociatedTypes_2fClassEqualities.html

Does anybody have a similarly simple and comprehensive translation of FDs to ATs?

Manuel




More information about the Haskell-prime mailing list