[Haskell-cafe] Aren't type system extensions fun? [Further analysis]

Roberto Zunino zunino at di.unipi.it
Thu May 29 07:44:24 EDT 2008

Kim-Ee Yeoh wrote:
> How about
>   foo :: (exists. m :: * -> *. forall a. a -> m a) -> (m Char, m Bool)

Thank you: I had actually thought about something like that.

First, the exists above should actually span over the whole type, so it 
becomes a forall because (->) is contravariant on its 1st argument:

    foo :: forall m :: * -> * . (forall a. a -> m a) -> (m Char, m Bool)

This seems to be Haskell+extensions, but note that m above is meant to 
be an arbitrary type-level function, and not a type constructor (in 
general).  So, I am not surprised if undecidability issues arise in type 
checking/inference. :-)

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.


More information about the Haskell-Cafe mailing list