[GHC] #15798: Flag to warn when deriving strategy is not explicitly specified

#15798: Flag to warn when deriving strategy is not explicitly specified -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In my code, I aim to always specify deriving strategies. I would like to add a flag `-fwarn-unspecified-deriving` that would cause a warning to be emitted when someone wrote this: {{{ newtype Foo = Foo Int deriving (Show) }}} The user would be required to instead write: {{{ newtype Foo = Foo Int deriving newtype (Show) }}} Or they could use `stock` if that was the behavior they wanted. This flag would be off by default. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15798 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15798: Flag to warn when deriving strategy is not explicitly specified -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by andrewthad): * cc: RyanGlScott (added) Comment: Ryan, if you to see if you had any thoughts on the name of the flag, I am welcome to suggestions. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15798#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15798: Flag to warn when deriving strategy is not explicitly specified -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): One other suggestion I've heard is `-Wimplicit-deriving-strategies` (mirroring the name of the `ImplicitPrelude` extension). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15798#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15798: Flag to warn when deriving strategy is not explicitly specified -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by andrewthad): That does sound better. I'll go with that. And I'm glad to know that someone else has thought about such a flag before. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15798#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15798: Flag to warn when deriving strategy is not explicitly specified -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: deriving, | newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => deriving, newcomer -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15798#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15798: Flag to warn when deriving strategy is not explicitly specified -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: deriving, | newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by monoidal): I would suggest `-Wmissing-deriving-strategies`, as there are several -Wmissing-* flags (missing-local-signatures, missing-import-lists, missing-home-modules etc.). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15798#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15798: Flag to warn when deriving strategy is not explicitly specified
-------------------------------------+-------------------------------------
Reporter: andrewthad | Owner: (none)
Type: feature request | Status: closed
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.6.1
Resolution: fixed | Keywords: deriving,
| newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| rename/should_compile/T15798{a,b,c}
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/48
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):
* status: new => closed
* testcase: => rename/should_compile/T15798{a,b,c}
* differential: => https://gitlab.haskell.org/ghc/ghc/merge_requests/48
* resolution: => fixed
* milestone: => 8.8.1
Comment:
Landed in
[https://gitlab.haskell.org/ghc/ghc/commit/c121e33f9b039acf2ac6939af8bfafe593...
c121e33f9b039acf2ac6939af8bfafe593560039]:
{{{
Author: chessai

#15798: Flag to warn when deriving strategy is not explicitly specified
-------------------------------------+-------------------------------------
Reporter: andrewthad | Owner: (none)
Type: feature request | Status: closed
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.6.1
Resolution: fixed | Keywords: deriving,
| newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| rename/should_compile/T15798{a,b,c}
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/48
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
participants (1)
-
GHC