Proposal: Turn on ScopedTypeVariables by default

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposal: Turn on ScopedTypeVariables by default

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?


_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Turn on ScopedTypeVariables by default

Andrew Farmer
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 <[hidden email]> 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. 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
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Turn on ScopedTypeVariables by default

Brandon Allbery
On Mon, Feb 23, 2015 at 12:59 PM, Andrew Farmer <[hidden email]> wrote:
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
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Turn on ScopedTypeVariables by default

Mario Blažević
In reply to this post by David Feuer
On 15-02-23 12:45 PM, 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. 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'd love this to happen, but not before it was specified in the next
Haskell standard.

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Turn on ScopedTypeVariables by default

Ben Franksen
In reply to this post by Brandon Allbery
Brandon Allbery wrote:

> On Mon, Feb 23, 2015 at 12:59 PM, Andrew Farmer <[hidden email]>
> wrote:
>
>> 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.)

The real problem with this syntax is the irregular and completely
unnecessary overloading of the dot. As if the dot weren't overloaded enough!
A much better choice would have been

  forall a b c in ...

This could still be changed: we could have both variants in parallel for a
while, then slowly deprecate the dot and finally scrap it.

Cheers
Ben
--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies and the other
way is to make it so complicated that there are no obvious deficiencies.
The first method is far more difficult."   ― C.A.R. Hoare

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Turn on ScopedTypeVariables by default

Roman Cheplyaka-2
In reply to this post by David Feuer
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
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users