On Sat, 20 Jun 1998, Lennart Augustsson wrote:
> > > class Aggregate a where
> > >  toList::(Num b)=>a->[b]
> > >  fromList::(Num b)=>[b]->a
> > 
> > > data MyAgg =Agg Int Int
> > > instance Aggregate MyAgg where
> > >  toList (Agg x y) = [x,y]
> > >  fromList [x,y] = (Agg x y)

> The type of toList in the class declaration claims that it can
> produce a list of any type in Num, but with MyAgg you can only get
> a list of Int.  So the type of toList in the class is more general
> than the one you have given.
> fromList has a similar problem.


I understand what it is saying.  I don't understand why it is a problem. 
MyAgg abides by the rules of Aggregate and will never cause a type error
when passed to a function that requires an Aggregate.  Why should MyAgg be
illegal?

-Alex-

___________________________________________________________________
S. Alexander Jacobson                   i2x Media  
1-212-697-0184 voice                    1-212-697-1427 fax


Reply via email to