Norman Ramsey <[EMAIL PROTECTED]> writes

> [..]
> class Formula f where
>   eval    :: f a -> Environment a -> Bool 
> [..]
> type Environment a = Var -> a
> type Var = String
> [..]
> data Formula f => Row a = Row (f a, Weight)
> type Weight = Float
>
> Hugs rejects this program:  [ .. ]


Maybe, the contexts are not needed in the data declarations.
I would write in your case something like   

  data Row f a = Row (f a, Weight) 

and then, define the same instances as the initially intended to 
define for Row: 
               instance (Context1 f a) => Foo1 (Row f a) where ...
               instance (Context2 f a) => Foo2 (Row f a) where ...
               ...
But there arises a question: as the instances define what is allowed 
to do with the data type under various conditions on its parameters, 
then why at all the language allows the `data' contexts?

-----------------
Serge Mechveliani
[EMAIL PROTECTED]




_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to