[Haskell-cafe] Intersection types for Haskell?
brianh at metamilk.com
Tue Jan 10 15:09:31 EST 2006
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.
More information about the Haskell-Cafe