Kevin Atkinson wrote:

>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.)

Here's the not allowed bit:

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

The kind of c in the above class declaration is * -> *. That is, unary type
constructors can be provided as actual arguments in instance declarations. 


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

The kind of c in this class declaration is * -> * -> *. That is, binary type
constructors can be provided as actual arguments in instance declarations.


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

Here you are trying to use c with two distinct kinds. 



Dan Russell
Kingston University


Reply via email to