Proposal: Turn on ScopedTypeVariables by default

I know this will be controversial, because it can break (weird) code and because it's not Haskell 2010, but hey, you can't make brain salad without breaking a few heads. ScopedTypeVariables is just awesome for two fundamental reasons: 1. It lets you write type signatures for more things. 2. It lets you write more precise type signatures for many things. As a consequence of those two, 3. It helps you get much better error messages from the type checker. And for all that, 4. It's really easy to use. What do other people think?

I have often thought the same thing. This is probably the language
extension I enable the most... a quick grep shows about 40% of my
modules.
I'm guessing the problem is that its not Haskell 98/2010? I think GHC
has a policy to do only what the spec says by default. Is that still
true now that AMP is implemented?
You could just always include it in the 'extensions' field of your
cabal file. Then it will apply to your whole project.
On Mon, Feb 23, 2015 at 11:45 AM, David Feuer
I know this will be controversial, because it can break (weird) code and because it's not Haskell 2010, but hey, you can't make brain salad without breaking a few heads. ScopedTypeVariables is just awesome for two fundamental reasons:
1. It lets you write type signatures for more things. 2. It lets you write more precise type signatures for many things.
As a consequence of those two,
3. It helps you get much better error messages from the type checker.
And for all that,
4. It's really easy to use.
What do other people think?
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

On Mon, Feb 23, 2015 at 12:59 PM, Andrew Farmer
I'm guessing the problem is that its not Haskell 98/2010? I think GHC has a policy to do only what the spec says by default. Is that still true now that AMP is implemented?
I think the main worry is that it steals syntax, specifically the `forall` keyword, which is just an identifier in H'98 and H'2010. (And some bikeshedding over `forall` being inappropriate for this use, but I suspect that ship sailed long ago.) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On 2015-02-23 at 18:45:20 +0100, David Feuer wrote:
I know this will be controversial, because it can break (weird) code and because it's not Haskell 2010, but hey, you can't make brain salad without breaking a few heads.
Are you suggesting enabling -XScopedTypeVariables for -XHaskell98 and -XHaskell2010? or rather for the default when neither of those two modes is explicitly requested? Just be warned though: this is somewhat of a trick-question... :-)

On 24/02/15 14:46, Herbert Valerio Riedel wrote:
On 2015-02-23 at 18:45:20 +0100, David Feuer wrote:
I know this will be controversial, because it can break (weird) code and because it's not Haskell 2010, but hey, you can't make brain salad without breaking a few heads.
Are you suggesting enabling -XScopedTypeVariables for -XHaskell98 and -XHaskell2010? or rather for the default when neither of those two modes is explicitly requested?
Just be warned though: this is somewhat of a trick-question... :-)
Maybe in addition to -XHaskell98 and -XHaskell2010 there should also be -XGhcHaskell. ghc already deviates from the standard by default (e.g. -XNondecreasingIndentation). OTOH we probably don't want end up with -fglasgow-exts once again. Roman
participants (5)
-
Andrew Farmer
-
Brandon Allbery
-
David Feuer
-
Herbert Valerio Riedel
-
Roman Cheplyaka