[Haskell-cafe] Functional dependenices in class declarations

Frank frank at geoinfo.tuwien.ac.at
Mon Aug 8 13:17:00 EDT 2005

In ghc 6.4 (fine work - many gratulations to all who did it!) it is
to have type parameters which are reachable ( context of type
I tried the following:

module TypeDependencies where

class A a b | a -> b 

class (A a b) => B b  where
    op :: a -> a
x :: A a b => a -> a
x = id

Which compiles fine for the function x, but does complain
"not in scope: type variable 'a' " for the class (A a b) => B b.

Is this an intentional restriction that 'reachable' type variables are only
permitted in type definitions, but not in classes? or do I misunderstand

Any help appreciated!
Andrew Frank

More information about the Haskell-Cafe mailing list