
10 Jan
2006
10 Jan
'06
3:09 p.m.
Brian Hulley wrote:
Taral wrote:
I have no idea what kind of function would have type (a -> b & c -> d). Can you give an example?
g x = x
because g 3 = 3 so g has type Int -> Int but also g 'a' = 'a' so g has type Char -> Char hence g has type Int -> Int & Char -> Char
Actually I should have said "g's type *matches* (Int->Int & Char->Char)" since of course g has type a->a. Regards, Brian.