[Haskell-cafe] ScopedTypeVariables

2013-08-06 Thread Evan Laforge
Occasionally I have to explicitly add a type annotation, either for clarity or to help choose a typeclass instance. Usually top-level type annotations take care of this, but sometimes it's convenient to only annotate a certain value, e.g. one argument of a lambda. I've noticed that while vanilla

Re: [Haskell-cafe] ScopedTypeVariables

2013-08-06 Thread Dan Doel
This is already a separate extension: PatternSignatures. However, that extension is deprecated for some reason. On Tue, Aug 6, 2013 at 2:46 PM, Evan Laforge qdun...@gmail.com wrote: Occasionally I have to explicitly add a type annotation, either for clarity or to help choose a typeclass

Re: [Haskell-cafe] ScopedTypeVariables

2013-08-06 Thread John Wiegley
Evan Laforge qdun...@gmail.com writes: Would it make sense to split it into a separate extension like TypesOnArguments so I can more accurately express my deviation from haskell2010 orthodoxy? Or is there some deeper tie between scoped type variables and annotations on arguments? I've also

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

2011-05-21 Thread Paolo G. Giarrusso
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

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

2011-05-21 Thread James Cook
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

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

2011-05-21 Thread Felipe Almeida Lessa
I have no problems in defining those functions: $ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ...

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

2011-05-21 Thread Daniel Fischer
On Saturday 21 May 2011 14:55:54, Paolo G. Giarrusso wrote: However, it turns out that Prelude let id2 :: Int - Int = \x - x works but there's no way whatsoever to make the following work: Prelude let (id2 :: forall t. t - t) = \x - x Works without problems or extensions in the form Prelude

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

2011-05-21 Thread Paolo G. Giarrusso
On May 21, 3:18 pm, Felipe Almeida Lessa felipe.le...@gmail.com wrote: I have no problems in defining those functions: $ ghci GHCi, version 6.12.3:http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done.

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

2011-05-21 Thread Brandon Allbery
On Sat, May 21, 2011 at 10:17, Paolo G. Giarrusso p.giarru...@gmail.comwrote: First, thanks to you and everybody for the alternative. But I'm still convinced that the syntax is supposed to work, and you're just workarounding the bug. Hm, I think we have differing expectations; the syntax

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

2011-05-21 Thread Daniel Fischer
On Saturday 21 May 2011 16:17:53, Paolo G. Giarrusso wrote: Moreover, the proposed solution not always works. Neither of these work: let f :: x - x; g :: y - y; (f, g) = (id, id) let f :: x - x; g :: y - y; (f, g) = (f, g) Requires -XNoMonoPatBinds

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

2011-05-21 Thread Felipe Almeida Lessa
On Sat, May 21, 2011 at 11:17 AM, Paolo G. Giarrusso p.giarru...@gmail.com wrote: As I said, I'm convinced that the argument of let is a pattern, on which a signature is allowed, and GHC correctly understands that, so that this declaration work: let (id :: Int - Int) = \x - x See both of:

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

2011-05-21 Thread Paolo Giarrusso
On Sat, May 21, 2011 at 16:27, Brandon Allbery allber...@gmail.com wrote: On Sat, May 21, 2011 at 10:17, Paolo G. Giarrusso p.giarru...@gmail.com wrote: First, thanks to you and everybody for the alternative. But I'm still convinced that the syntax is supposed to work, and you're just

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

2011-05-21 Thread Daniel Fischer
On Saturday 21 May 2011 16:17:53, Paolo G. Giarrusso wrote: As I said, I'm convinced that the argument of let is a pattern, on which a signature is allowed, and GHC correctly understands that, so that this declaration work: let (id :: Int - Int) = \x - x I don't think that Prelude let a ::

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

2011-05-21 Thread Paolo Giarrusso
On Sat, May 21, 2011 at 16:46, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Sat, May 21, 2011 at 11:17 AM, Paolo G. Giarrusso p.giarru...@gmail.com wrote: As I said, I'm convinced that the argument of let is a pattern, on which a signature is allowed, and GHC correctly understands

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

2011-05-21 Thread Brandon Allbery
On Sat, May 21, 2011 at 10:49, Paolo Giarrusso p.giarru...@gmail.comwrote: On Sat, May 21, 2011 at 16:27, Brandon Allbery allber...@gmail.com wrote: On Sat, May 21, 2011 at 10:17, Paolo G. Giarrusso p.giarru...@gmail.com wrote: First, thanks to you and everybody for the alternative.

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

2011-05-21 Thread Paolo Giarrusso
On Sat, May 21, 2011 at 17:13, Brandon Allbery allber...@gmail.com wrote: On Sat, May 21, 2011 at 10:49, Paolo Giarrusso p.giarru...@gmail.com wrote: On Sat, May 21, 2011 at 16:27, Brandon Allbery allber...@gmail.com wrote: On Sat, May 21, 2011 at 10:17, Paolo G. Giarrusso