[Haskell-cafe] Inference for RankNTypes
f at mazzo.li
Wed Jan 2 14:21:55 CET 2013
At Wed, 2 Jan 2013 14:49:51 +0200,
Roman Cheplyaka wrote:
> I don't see how this is relevant.
Well, moving `flip one' in a let solves the problem, and The fact that let-bound
variables are treated differently probably has a play here. I originally
thought that this was because the quantifications will be all to the left in the
let-bound variable while without a let-bound variable the types are used
directly. However this doesn’t explain the behaviour I’m seeing.
> GHC correctly infers the type of "flip one 'x'":
> *Main> :t flip one 'x'
> flip one 'x' :: (forall a. a -> a) -> Char
> But then somehow it fails to apply this to id. And there are no bound
> variables here that we should need to annotate.
Right. The weirdest thing is that annotating `flip one' (as in `three' in my
code) or indeed `flip one 'x'' with the type that shows up in ghci makes
five = (flip one 'x' :: (forall a. a -> a) -> Char) id
More information about the Haskell-Cafe