[GHC] #14593: Allow deprecation notices for type and data constructors separately

#14593: Allow deprecation notices for type and data constructors separately -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature | Status: new request | Priority: low | Milestone: Component: Compiler | Version: 8.2.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: -------------------------------------+------------------------------------- The [https://downloads.haskell.org/~ghc/8.2.2/docs/html/users_guide/glasgow_exts.... #warning-and-deprecated-pragmas syntax for deprecations] only allows you to provide a single message for deprecations:
You can only attach to entities declared at top level in the module being compiled, and you can only use unqualified names in the list of entities. A capitalised name, such as T refers to either the type constructor T or the data constructor T, or both if both are in scope. If both are in scope, there is currently no way to specify one without the other (c.f. fixities Infix type constructors, classes, and type variables).
It would be nice to provide separate messages in deprecations for type and data constructors. As an example, I am making a breaking change to a library, and I am providing deprecated shims for backwards-compatibility: {{{ -- Old: data SomeField rec where SomeField :: EntityField rec field -> SomeField rec -- New: data UpdateCollision rec where CopyField :: EntityField rec field -> UpdateCollision rec CopyUnless :: -- etc... type SomeField = UpdateCollision {-# DEPRECATED SomeField "The SomeField type was renamed to UpdateCollision." #-} pattern SomeField :: EntityField record typ -> SomeField record pattern SomeField x = CopyField x {-# DEPRECATED SomeField "The constructor SomeField is deprecated. Use the function copyField instead." #-} }}} The workaround is to provide a longer error message that combines the two. This is less pleasant than having separate notices, because it makes it less obvious for the client how to migrate. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14593 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14593: Allow deprecation notices for type and data constructors separately -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.2.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 nomeata): There was a recent GHC proposal that asked for that, and it got accepted, so someone just has to implement it: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0008 -type-infix.rst -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14593#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14593: Allow deprecation notices for type and data constructors separately -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.2.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 parsonsmatt): Ah, nice! I'll close this out then :) Thanks for the pointer! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14593#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14593: Allow deprecation notices for type and data constructors separately -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: closed Priority: low | Milestone: Component: Compiler | Version: 8.2.1 Resolution: duplicate | 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 parsonsmatt): * status: new => closed * resolution: => duplicate -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14593#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC