Proposal #270: Support pun-free code. Recommendation: accept

Hi all, I have been assigned to shepherd 'Proposal #270: Support pun-free code’ and this is my second attempt to reach a conclusion (see below for for my original encapsulation of the proposal). As I said, my outstanding concern was that some could see this proposal as a green-lighting a general move against the use of these puns in general Haskell code as ‘bad style. The author has now clarified in the proposal that it should not be seen in this light. Unless anyone has any outstanding objections I suggest the we accept the proposal — or at least hold an up-and-down vote to resolve whether we are going to accept the proposal or not. I vote yes to accepting this proposal. Chris — My original summary: Proposal text: https://github.com/hithroc/ghc-proposals/blob/master/proposals/0000-support-... https://github.com/hithroc/ghc-proposals/blob/master/proposals/0000-support-... Proposal discussion: https://github.com/ghc-proposals/ghc-proposals/pull/270 https://github.com/ghc-proposals/ghc-proposals/pull/270 The proposal helps manage @data T = T@ style definitions that use the same name for type and data constructors. It introduces -Wpuns and -Wpun-bind to warn about puns at usage and binding sites, respectively, and adds qualified import syntax for importing selectively into the data and type name spaces: import Data.Proxy type qualified as T -- import only the type namespace import Data.Proxy data qualified as D -- import only the data namespace As the low number indicates the proposal has been around for a while and the author has an implementation PR: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2044 https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2044. The most active discussion point was Simon’s observation that this extension introduces a ‘fork’ in the language: https://github.com/ghc-proposals/ghc-proposals/pull/270#issuecomment-5361155... https://github.com/ghc-proposals/ghc-proposals/pull/270#issuecomment-5361155.... (See Simon’s comment at the link for an explanation of the Haskell language fork idea.) There is a long tradition of using data/type constructor puns (older than Haskell itself) and many people will consider it good style (I certainly do), while others do not, and they will benefit from tools to help manage and limit their use. So, notwithstanding the fork-like nature of the proposal, because it is not very intrusive (some warnings with finer control of qualified imports), and it is helping folks to establish a subset that they are maintaining anyway, I am minded to accept this proposal — though it was close. My sole concern is that it could give rise to contentious pressure on the wider Haskell community to embrace the subset. To (avoiding) this end, I suggest that we include wording in the user guide section documenting this extension to the effect that there is no consensus on the desirability or otherwise of the punful code the extension seeks to address.

I'm in support. I'm supporting this proposal so that Haskell can be a
friendly home both for those who like punning and those who don't. I'm not
taking a position on which is "better", but I don't want to stand in the
way of those who do have a view and want to write in that style.
Simon
On Mon, 5 Dec 2022 at 18:33, Chris Dornan
Hi all,
I have been assigned to shepherd 'Proposal #270: Support pun-free code’ and this is my second attempt to reach a conclusion (see below for for my original encapsulation of the proposal).
As I said, my outstanding concern was that some could see this proposal as a green-lighting a general move against the use of these puns in general Haskell code as ‘bad style. The author has now clarified in the proposal that it should not be seen in this light.
Unless anyone has any outstanding objections I suggest the we accept the proposal — or at least hold an up-and-down vote to resolve whether we are going to accept the proposal or not.
I vote yes to accepting this proposal.
Chris
—
My original summary:
Proposal text: https://github.com/hithroc/ghc-proposals/blob/master/proposals/0000-support-...
Proposal discussion: https://github.com/ghc-proposals/ghc-proposals/pull/270
The proposal helps manage @data T = T@ style definitions that use the same name for type and data constructors.
It introduces -Wpuns and -Wpun-bind to warn about puns at usage and binding sites, respectively, and adds qualified import syntax for importing selectively into the data and type name spaces:
import Data.Proxy type qualified as T -- import only the type namespace import Data.Proxy data qualified as D -- import only the data namespace
As the low number indicates the proposal has been around for a while and the author has an implementation PR: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2044.
The most active discussion point was Simon’s observation that this extension introduces a ‘fork’ in the language: https://github.com/ghc-proposals/ghc-proposals/pull/270#issuecomment-5361155.... (See Simon’s comment at the link for an explanation of the Haskell language fork idea.)
There is a long tradition of using data/type constructor puns (older than Haskell itself) and many people will consider it good style (I certainly do), while others do not, and they will benefit from tools to help manage and limit their use. So, notwithstanding the fork-like nature of the proposal, because it is not very intrusive (some warnings with finer control of qualified imports), and it is helping folks to establish a subset that they are maintaining anyway, I am minded to accept this proposal — though it was close.
My sole concern is that it could give rise to contentious pressure on the wider Haskell community to embrace the subset. To (avoiding) this end, I suggest that we include wording in the user guide section documenting this extension to the effect that there is no consensus on the desirability or otherwise of the punful code the extension seeks to address.
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

If you read the "Resolved Syntax Tree" section of #281, you can see the
contortions it has to go through to support puns. It's very nuanced! I can
easily imagine future users of RequiredTypeArguments struggle with type
errors because they wanted to use a name from one namespace but this
elaborate system selected a name from another namespace. -Wpuns would
prevent this from happening: it can help identify namespace ambiguities and
avoid them.
It is mainly for this reason that I vote +1.
And I'm happy to see the disclaimer that it is not "bad style" to use puns.
What is considered good or bad often depends on context. In a module with
RequiredTypeArguments, I would prefer to see -Wpuns enabled. In a module
without it, I don't particularly care.
Vlad
On Mon, Dec 5, 2022 at 9:33 PM Chris Dornan
Hi all,
I have been assigned to shepherd 'Proposal #270: Support pun-free code’ and this is my second attempt to reach a conclusion (see below for for my original encapsulation of the proposal).
As I said, my outstanding concern was that some could see this proposal as a green-lighting a general move against the use of these puns in general Haskell code as ‘bad style. The author has now clarified in the proposal that it should not be seen in this light.
Unless anyone has any outstanding objections I suggest the we accept the proposal — or at least hold an up-and-down vote to resolve whether we are going to accept the proposal or not.
I vote yes to accepting this proposal.
Chris
—
My original summary:
Proposal text: https://github.com/hithroc/ghc-proposals/blob/master/proposals/0000-support-...
Proposal discussion: https://github.com/ghc-proposals/ghc-proposals/pull/270
The proposal helps manage @data T = T@ style definitions that use the same name for type and data constructors.
It introduces -Wpuns and -Wpun-bind to warn about puns at usage and binding sites, respectively, and adds qualified import syntax for importing selectively into the data and type name spaces:
import Data.Proxy type qualified as T -- import only the type namespace import Data.Proxy data qualified as D -- import only the data namespace
As the low number indicates the proposal has been around for a while and the author has an implementation PR: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2044.
The most active discussion point was Simon’s observation that this extension introduces a ‘fork’ in the language: https://github.com/ghc-proposals/ghc-proposals/pull/270#issuecomment-5361155.... (See Simon’s comment at the link for an explanation of the Haskell language fork idea.)
There is a long tradition of using data/type constructor puns (older than Haskell itself) and many people will consider it good style (I certainly do), while others do not, and they will benefit from tools to help manage and limit their use. So, notwithstanding the fork-like nature of the proposal, because it is not very intrusive (some warnings with finer control of qualified imports), and it is helping folks to establish a subset that they are maintaining anyway, I am minded to accept this proposal — though it was close.
My sole concern is that it could give rise to contentious pressure on the wider Haskell community to embrace the subset. To (avoiding) this end, I suggest that we include wording in the user guide section documenting this extension to the effect that there is no consensus on the desirability or otherwise of the punful code the extension seeks to address.
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

Hi, generally in favor; these new warnings shoudn’t do harm and are hopefully useful to some. But I have a technical issue (sorry for being so late with that): I note that this proposal extends -XExplicitNamespaces, which so far can be used to distinguish type from term operators in export and import lists, by allowing them to be prefixed with `type` (but not `data`!), as in: import N( f, type (++) ) https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/explicit_name... The new extension now extends this extension the import qualified Foo data as FD import qualified Foo type as FT forms to “filter” imports by namespace. A few points: * It seems to be inconsistent to allow both `type` and `data` in the filtered-import, but as a qualifier on individual only `type`. Should we allow the use of `data` in import/export lists as well? import N(f, type (++), data (+)) * As discussed in https://github.com/ghc-proposals/ghc-proposals/issues/551, -XExplicitNamespaces, which is quite old and is implied by -XTypeOperators which is implied by -XGHC2021 probably ought to have been in GHC2021 as well, and I’d like to include it in GHC2023 (if that exists) to fix that (see #559). But that feels inappropriate if we extend that extension in this way. We could side-step that issue if we put he new forms in their own language extension (maybe -XNamespacedImport)? WDYT? Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/

On the first point , I suggest we propose it in the thread and see what the author has to say. On the second point I am all in favour of splitting out -XNamespacedImport. Chris
On 7 Dec 2022, at 18:12, Joachim Breitner
wrote: Hi,
generally in favor; these new warnings shoudn’t do harm and are hopefully useful to some.
But I have a technical issue (sorry for being so late with that):
I note that this proposal extends -XExplicitNamespaces, which so far can be used to distinguish type from term operators in export and import lists, by allowing them to be prefixed with `type` (but not `data`!), as in: import N( f, type (++) ) https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/explicit_name...
The new extension now extends this extension the
import qualified Foo data as FD import qualified Foo type as FT
forms to “filter” imports by namespace. A few points:
* It seems to be inconsistent to allow both `type` and `data` in the filtered-import, but as a qualifier on individual only `type`. Should we allow the use of `data` in import/export lists as well?
import N(f, type (++), data (+))
* As discussed in https://github.com/ghc-proposals/ghc-proposals/issues/551, -XExplicitNamespaces, which is quite old and is implied by -XTypeOperators which is implied by -XGHC2021 probably ought to have been in GHC2021 as well, and I’d like to include it in GHC2023 (if that exists) to fix that (see #559). But that feels inappropriate if we extend that extension in this way.
We could side-step that issue if we put he new forms in their own language extension (maybe -XNamespacedImport)? WDYT?
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

Hi, Am Mittwoch, dem 07.12.2022 um 21:15 +0000 schrieb Chris Dornan:
On the first point , I suggest we propose it in the thread and see what the author has to say.
On the second point I am all in favour of splitting out - XNamespacedImport.
If you are in favor of putting it under -XNamespacedImport, I suggest we don’t bother the authors with “cleaning up” ExplicitNamespaces, and leave that to a separate proposal (if at all). Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/

Hi Joachim, * It seems to be inconsistent to allow both `type` and `data` in the
filtered-import, but as a qualifier on individual only `type`. Should we allow the use of `data` in import/export lists as well?
import N(f, type (++), data (+))
The "data" qualifier is also in the proposal, but it's behind PatternSynonyms rather than ExplicitNamespaces. That's because it is meant to replace the "pattern" qualifier, which is currently enabled by PatternSynonyms. However, I think you make a very good point: both of those qualifiers should be enabled by the same extension, ExplicitNamespaces.
* As discussed in https://github.com/ghc-proposals/ghc-proposals/issues/551, -XExplicitNamespaces, which is quite old and is implied by -XTypeOperators which is implied by -XGHC2021 probably ought to have been in GHC2021 as well, and I’d like to include it in GHC2023 (if that exists) to fix that (see #559). But that feels inappropriate if we extend that extension in this way.
We could side-step that issue if we put he new forms in their own language extension (maybe -XNamespacedImport)? WDYT?
#281 also modifies ExplicitNamespaces to enable inline "type" qualifiers in expressions. Do you want a separate extension for that also?

Hi, Am Donnerstag, dem 08.12.2022 um 10:43 +0300 schrieb Vladislav Zavialov:
#281 also modifies ExplicitNamespaces to enable inline "type" qualifiers in expressions. Do you want a separate extension for that also?
ah, I knew we had that somewhere! Thanks for reminding me! So with #281, I can use inline `type` everywhere where I refer to a name? Or only in expressions? Reading the spec I can only use them in expressions – why not in types? And is there no dual use-case to refer to data in types, e.g. with promoted types? My current gut feeling is that there could be a simple unified “explicit namespace qualifier” that I can use essentially everywhere when I want to be explicit which Foo I mean – expressions, types, import lists, export lists, INLINE pragmas. ExplicitNamespaces sounds like the natural name for that extensions, and nicely extends it. I am unsure if it is wise to extend ExplicitNamespaces that way and at the same time advocate for its inclusion in GHC20xx. This depends a bit on how bold we want to be with GHC20xx. A conservative approach is to find a new name for the “comprehensive” extension. I expect that extension would then subsume the changes in #281. The extension to imports in #270 has a slightly different feel to it – you are not qualifying a name here, but you are really filtering all imported names. I think putting that into its own extension makes sense for two reasons: * It decouples these discussions for now. * It may be that -XNamespacedImport turns out to be not that useful when instead you can disambiguate at the occurrence or in an explicit import list using (comprehensive) ExplicitNamespaces, and one possible future may be that that style will be more common. Then we may want to make one, but not the other, the default. Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/
participants (4)
-
Chris Dornan
-
Joachim Breitner
-
Simon Peyton Jones
-
Vladislav Zavialov