Hi,

I am running "hugs -98" on Solaris, version February 2000.

I get the following strange error message:

>>>
Main> generalZipWith (+) [1,2,3] [3,4,5] :: [Int] 
ERROR: Cannot justify constraints in type annotation
*** Expression    : generalZipWith (+) [1,2,3] [3,4,5]
*** Type          : [Int]
*** Given context : ()
*** Constraints   : (Num Int, Num Int, Num Int, Num Int, Num Int, Num Int, Num Int)
<<<

Apart from looking at the program that generates this
message, isn't it a bit strange that it complains about
unjustified constraints of the form "Num Int"? How can this
constraint be unjustified??

When I write all the types explicitly I get the correct
answer:

>>>
Main> generalZipWith (+) ([1,2,3]::[Int]) ([3,4,5]::[Int]) :: [Int]
[4,6,8]
<<<

The program generating this is attached.

Regards,
Koen.

--
Koen Claessen         http://www.cs.chalmers.se/~koen     
phone:+46-31-772 5424      mailto:[EMAIL PROTECTED]
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden

class Zip a b | b -> a where
  zipper :: [a] -> b

instance Zip a [a] where
  zipper as = as

instance Zip a b => Zip (x -> a) ([x] -> b) where
  zipper fs as = zipper (zipWith ($) fs as)

generalZipWith :: Zip a b => a -> b
generalZipWith f = zipper (repeat f)

Reply via email to