foralls in class assertions

Ashley Yakeley ashley@semantic.org
Sat, 16 Feb 2002 02:47:56 -0800


It would be nice to be able to put foralls in class assertions. For 
instance:

    class HasIdentity a where
        {
        identity :: a;
        };
    
    class Composable a b ab | a b -> ab where
        {
        compose :: a -> b -> ab;
        };
    
    class
        (
        forall a. HasIdentity (m a a),
        forall a b c. Composable (m b c) (m a b) (m a c)
        ) =>
     Category m;
    
    instance
        (
        forall a. HasIdentity (m a a),
        forall a b c. Composable (m b c) (m a b) (m a c)
        ) =>
     Category m;

Or even allow the foralls their own context:

    foo :: (forall a. (C a b) => D a c) => T b c;

Does this make sense? Would it have unpleasant consequences?


-- 
Ashley Yakeley, Seattle WA