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.

Regards,
Zun.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to