
29 May
2008
29 May
'08
9:34 a.m.
Another valid type for foo can be done AFAICS with intersection types:
foo :: (Char -> a /\ Bool -> b) -> (a,b)
But I can not comment about their inference, or usefulness in practice.
Again, undecidable :) In fact, I believe that an inference algorithm for intersection types is equivalent to solving the halting problem. Type checking however is decidable, but expensive.
a.k.a. find some value that matches both Char->a and Bool->b for some a and b. Could use type-classes to do it. But why, when we can just use standard tuples instead? foo :: (Char -> a , Bool -> b) -> (a,b) Admittedly this function is isomorphic to type (Char,Bool)... but that's a different issue, with the arbitrariness of our choice of example function. -Isaac