[Haskell-cafe] ScopedTypeVariables in let-bindings (not where-bindings!) and bug 4347

James Cook mokus at deepbondi.net
Sat May 21 15:15:38 CEST 2011

On May 21, 2011, at 8:55 AM, Paolo G. Giarrusso wrote:

> Hi all, I have some problem with ScopedTypeVariables, let and so on,
> at least in GHC 7.
> My aim is to be able to supply a polymorphic type signature in let
> bindings. Confusingly, I find no such example in the blog post about
> local let generalization [1]. I first met this problem when porting
> some test-code from Kiselyov, when refusing to convert its let-
> bindings into where-bindings (which, btw, can't be typed into GHCi).
> I've also added a comment to the bug report, but it's still quite
> possible that I'm missing something.

You don't need ScopedTypeVariables for this, you can just give type  
signatures in the let binding:

Prelude> let id2 :: t -> t; id2 = \x -> x in (id2 '1', id2 10)

-- James

More information about the Haskell-Cafe mailing list