Could someone tell me why this is not allowed and if there is a possible
workaround. (I know this example seems pointless however it is a real
concern as having bulk types in the context is something I would really
like to do.)

class Listable c a where
  toList     :: c a -> [a]

class Find c a b where
  find       :: a -> c a b -> b

instance Listable [] a where
  toList c = c

instance (Listable c (a,b)) => Find c a b where
  find a c = lookup a (toList c)

$ hugs -98 test.hs
ERROR "test.hs" (line 11): Illegal type in class constraint

ghc -fglasgow-exts -fallow-undecidable-instances test.hs
test.hs:12:
    Couldn't match `* -> *' against `*'
        Expected kind: (* -> * -> *) -> * -> * -> *
        Inferred kind: (* -> *) -> * -> * -> *
    When checking kinds in `Find c a b'

-- 
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/


Reply via email to