[Haskell-cafe] Aren't type system extensions
fun? [Further analysis]
isaacdupree at charter.net
Thu May 29 09:34:50 EDT 2008
>> 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.
More information about the Haskell-Cafe