Christian Sievers <[EMAIL PROTECTED]>

writes (I format the text)

> The report says explicit that instance declarations like
>
>                instance C (a,a) where ...,    
> 
> or for  (Int,a)  or for  [[a]] 
>
> are not allowed. I tried to understand this by thinking these 
> types are too complex, but I had to learn that a type may also
> be too simple, i.e. just writing   
>                              instance D a 
> is not allowed either.
> ...



As to   `instance D a',   
it is not a loss. Because `instance D a' is the same as  
`class D a' - supplied with the default definition. For example,
the illegal declaration pair

          class    C a => D a  where  d :: a -> a

          instance C a => D a  where  d = <definition>


can be replaced with the legal and simpler declaration

          class C a => D a  where  d :: a -> a
                                   d = <definition>

Correct me please, if this is a mistake, I am not much of an 
expert in Haskell (though keep on programming for two years!)


As to         instance ... => C (a  ,a)  where ..., 
              ...          => C (Int,a)  where ..., 
and such,  
they might express a very meaningful mathematical sense, these
constructions are highly desirable. 

And, yes, the *overlapping instances* too. 
The developers often say these overlaps conflict with the separate 
compilation. But separate compilation is rather a technical detail. 
Besides, might it occure some way-out ... - ?


-------------------------------------
Sergey Mechveliani   [EMAIL PROTECTED]







Reply via email to