Search code examples
haskellfunctional-dependencies

Functional dependency of multiple types


Is the following possible (in spirit) with the GHC?

-- Syntax error: parse error on input `a'
class Foo a b c | (a, b) -> c where
  foo :: a -> b -> c

What alternatives do I have?


Solution

  • class Foo a b c | a b -> c should work fine; it's the same syntax on the right-hand side, too.

    as -> bs simply means that as collectively determines every bs.