
I'm trying out MPTC with functional dependencies for the first time in GHC. However, I'm not sure of the syntax. MPJ's ESOP 2000 paper gives the following example: class FiniteMap i e fm | fm -> (i,e) where emptyFM :: fm lookupFM :: i -> fm -> Maybe e extendFM :: i -> e -> fm -> fm but ghc (5.02.2 and 5.04.1) complain $ ghc-5.04.1 -fglasgow-exts -c -o FunDep.o FunDep.hs FunDep.hs:10: parse error on input `(' where the indicated line is that of the class declaration. What should the syntax be if it is not the above? Regards, Malcolm

You don't need the parentheses. So, you want something like: class Foo a b c d e | a b -> c d, a -> d e where... which means from the paper: class Foo a b c d e | (a,b) -> (c,d), a -> (d,e) HTH - Hal -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Mon, 11 Nov 2002, Malcolm Wallace wrote:
I'm trying out MPTC with functional dependencies for the first time in GHC. However, I'm not sure of the syntax. MPJ's ESOP 2000 paper gives the following example:
class FiniteMap i e fm | fm -> (i,e) where emptyFM :: fm lookupFM :: i -> fm -> Maybe e extendFM :: i -> e -> fm -> fm
but ghc (5.02.2 and 5.04.1) complain
$ ghc-5.04.1 -fglasgow-exts -c -o FunDep.o FunDep.hs FunDep.hs:10: parse error on input `('
where the indicated line is that of the class declaration. What should the syntax be if it is not the above?
Regards, Malcolm _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (2)
-
Hal Daume III
-
Malcolm Wallace