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

Andrew Coppin andrewcoppin at btinternet.com
Mon May 26 17:35:03 EDT 2008

Thomas Davie wrote:
> This is perhaps best explained with an example of something that can 
> be typed with rank-2 types, but can't be typed otherwise:
> main = f id 4
> f g n = (g g) n
> We note that the same instance of id must be made to have both the 
> type (Int -> Int) and ((Int -> Int) -> (Int -> Int)) at the same 
> time.  Rank 2 types allows us to do this.

What a perplexing example! :-}

Well anyway, I was under the impression that id :: x -> x, so I'm not 
really sure why this wouldn't work without Rank-2 types...

More information about the Haskell-Cafe mailing list