newbie question regarding type declarations

ketil+haskell at ii.uib.no ketil+haskell at ii.uib.no
Fri Oct 31 13:13:45 EST 2003


"gangadhar npk" <phani at myrealbox.com> writes:

> square :: (Num a, Num b) => (a ,b)
> square (x , y) = (x*x , y*y)

> How can I specify that the square functions output would be a pair ?

Why don't you try it without the type declaration, and see what Hugs
or GHCi thinks the type is?  This should make it pretty clear what the
problem is, I think.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list