To my letter on Haskell-2 with

>>Remark and question on the ambiguity problem 
>>M.Jones & S.P.Jones  paper "...Exploration of Design Space."

Dominic Duggan <[EMAIL PROTECTED]> 
writes

>E. Meijer is also an author of this paper. 

I am sorry.


>Matrix multiplication:  * :: Matrix a -> Matrix b -> Matrix c 
>
>does not satisfy the single-argument restriction, or even 
>its generalization to an n-argument restriction. 
>What happens if  M1 :: Matrix Int   and I type:  M2 = M1 * M1 * M1 
>
>I get:   Mult (Matrix Int) (Matrix Int) a, Mult a (Matrix Int) b => b 
>
>and type-checking fails due to ambiguity.  You have to say:
>
>M2 = ((((M1 * M1) :: (Matrix Int)) * M1) :: (Matrix Int))
>
>[...]


Could you explain all this?
Are you considering the program

  class Mult a b c  where  (*) :: a -> b -> c 

  instance ...=> Mult (Matrix a) (Matrix b) (Matrix c) where  (*) = ...

  f =  let  m1 =...:: Matrix Int  in   (m1*m1)*m1
?

Or maybe, `*' is a type constructor?
In Haskell `M1',`M2' cannot denote a value.  `m1',`m2' can.
And the question was of the ambiguity of a class operation definition.


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















Reply via email to