
I'm trying to encode a well-known, informally-specified type system in Haskell. What causes problems for me is that type classes force types to be of a specific kind. The system I'm targeting however assumes that its equivalent of type classes are kind-agnositic. For instance, I've got class Assignable a where assign :: a -> a -> IO () class Swappable a where swap :: a -> a -> IO () class CopyConstructible a where copy :: a -> IO a class (Assignable a, CopyConstructible a) => ContainerType a class (Swappable c, Assignable c, CopyConstructible c) => Container c where size :: (Num i, ContainerType t) => c t -> IO i I suppose I could address this with creating aliases for the relevant classes, but I wonder if there is a better workaround. I see that the ML module system has a similar restriction on type sharing. Is there a fundamental reasons behind this?