Kinds Workaround
Ashley Yakeley
ashley@semantic.org
Fri, 8 Feb 2002 17:35:25 -0800
At 2002-02-08 03:36, Koen Claessen wrote:
>Here, you might do the following trick:
>
> type HasKind_Help x dummy = x
> type HasKind_Star_To_Star x = HasKind_Help x (x Int)
>
> type C c x y = c (HasKind_Star_To_Star x)
> (HasKind_Star_To_Star y)
>
> type Composer c =
> forall x y z . C c y z -> C c x y -> C c x z
Yuck... I discovered a much simpler workaround, a class which has a
parameter of kind '*':
class T a where
{
undef :: a; -- force kind '*'
};
instance T a where -- true for all types
{
undef = undefined;
};
data (T (p Bool),T (q Bool)) => CMap0 p q = MkCMap0;
type Composer c = forall x y z. (T (x Bool)) => (c y z) -> (c x y) ->
(c x z);
Neat, huh? Finally, a reason for allowing contexts in data type
declarations!
--
Ashley Yakeley, Seattle WA