[GHC] #16009: Deprecate `optional` from Text.ParserCombinators.ReadP

#16009: Deprecate `optional` from Text.ParserCombinators.ReadP -------------------------------------+------------------------------------- Reporter: dbaynard | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.3 Component: | Version: 8.6.2 libraries/base | Keywords: Applicative, | Operating System: Unknown/Multiple Parsers, ReadP | Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It seems there is some disagreement on what the type of `optional` should be, within `base`. `Control.Applicative` defines it as {{{#!haskell optional :: Alternative f => f a -> f (Maybe a) }}} By contrast, `Text.ParserCombinators.ReadP` defines it as {{{#!haskell optional :: ReadP a -> ReadP () }}} Worse, ReadP implements `Alternative`. So it entirely possible to specialise {{{#!haskell optional :: ReadP a -> ReadP (Maybe a). }}} In the broader Haskell ecosystem (and beyond) there is further confusion. The `Applicative` definition is used by `parsers`, `megaparsec` and purescript's `Data.Maybe`. The `ReadP` definition is used by `Parsec` and purescript's `Text.Parsing.StringParser`. `Cabal`, like `base` defines both. I propose to begin to deprecate `ReadP.optional` ASAP, following suggestions in https://www.reddit.com/r/haskell/comments/8cqgds/inconsistent_optional_defin.... Code which used the old form may still compile; otherwise `void` should be applied. There have been some suggestions for new names for the `ReadP` definition, such as `optionally` or `optional_`. It may be worth exporting this function directly from `Control.Applicative`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16009 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16009: Deprecate `optional` from Text.ParserCombinators.ReadP -------------------------------------+------------------------------------- Reporter: dbaynard | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.8.1 Component: libraries/base | Version: 8.6.2 Resolution: | Keywords: Applicative, | Parsers, ReadP Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dbaynard): * milestone: 8.6.3 => 8.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16009#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16009: Deprecate `optional` from Text.ParserCombinators.ReadP -------------------------------------+------------------------------------- Reporter: dbaynard | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.10.1 Component: libraries/base | Version: 8.6.2 Resolution: | Keywords: Applicative, | Parsers, ReadP Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dbaynard): This is currently blocked on a decision (from the core libraries committee?) on how to proceed — either to take it up (and begin the deprecation process for `optional`, to propose a way to take it to the wider community (a process I'm happy to lead), or to dismiss as wontfix. Whatever the case, I would like to begin the process as soon as possible; perhaps even beginning deprecation in the next major release. It seems like this would languish here, otherwise. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16009#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16009: Deprecate `optional` from Text.ParserCombinators.ReadP -------------------------------------+------------------------------------- Reporter: dbaynard | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.10.1 Component: libraries/base | Version: 8.6.2 Resolution: | Keywords: Applicative, | Parsers, ReadP Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): It isn't really clear what the advantage here is to deprecating this function. There is the clear disadvantage that it will break people's programs which use it. Does anyone feel the pain of this inconsistency? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16009#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16009: Deprecate `optional` from Text.ParserCombinators.ReadP -------------------------------------+------------------------------------- Reporter: dbaynard | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.10.1 Component: libraries/base | Version: 8.6.2 Resolution: | Keywords: Applicative, | Parsers, ReadP Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dbaynard): I can certainly give a reason to deprecate (I wouldn't underestimate the confusion caused by this inconsistency; error messages for functions of the same name are often difficult to process) but I'm not well placed to describe it as an advantage. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16009#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC