Hello Wei,

Thursday, May 8, 2008, 11:10:08 PM, you wrote:

> test :: a -> Int -> a

> shift is defined as "a -> Int -> a"

not exactly ;)  this type signature is given inside class Bits, where
'a' isn't a free variable (as in standalone signature declaration),
but means 'a' from type class header:

class Num a => Bits a where
    shift             :: a -> Int -> a

so, this declaration is equivalent to the following standalone one:

shift :: (Bits a) =>  a -> Int -> a


from the common sense POV, you can't shift *ANY* type 'a', but only
types that belong to the Bits class. so, shift cannot have signature
w/o class, and the same remains true for `test`


-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to