[GHC] #14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension)

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.1 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: #13126 #9224 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Implement Underscores in Numeric Literals Proposal. GHC supports various numeric literals such as decimal, octal, hexadecimal, binary, and floating point numbers. However, large numeric literals are hard to read. This proposal improves the readability, quality, expressiveness of numeric literals. This proposal allows underscores to numeric literals when the `NumericUnderscores` language extension is enabled. Underscores (`_`) in numeric literals are simply ignored. The specification of the feature is available here:\\ https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0009 -numeric-underscores.rst For a discussion:\\ https://github.com/ghc-proposals/ghc-proposals/pull/76 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by takenobu): I am planning to submit a patch. This is the patch of the current version:\\ https://github.com/takenobu-hs/ghc/compare/master...takenobu-hs:wip /numeric-underscores About it, Iavor gave me good advice:\\ https://github.com/ghc-proposals/ghc- proposals/pull/76#issuecomment-344347463 That is, I unify the definition of Lexer and add a validation function. After investigating how to implement the function for validation, I will submit the patch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: new Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by takenobu): * owner: (none) => takenobu -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: patch Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Changes (by takenobu): * status: new => patch * differential: => Phab:D4235 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: patch Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Comment (by takenobu): I submitted a patch Phab:D4235. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: patch Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Comment (by takenobu): For the later people, I record about the correspondence status of the syntax highlight on editors and code browsers for `BinaryLiterals`, `HexFloatLiterals` and `NumericUnderscores` extensions. * Vim * It has already been officially implemented. Since patch 8.0.1401 * https://github.com/vim/vim/pull/2455 * Emacs * Lowercase literals are already almost correctly displayed. * `haskell-lexeme.el` and `haskell-font-lock.el` * Atom (language-haskell package) * It has already been officially implemented. Since 1.15.0 * https://github.com/atom-haskell/language-haskell/pull/112 * Visual Studio Code (language-haskell extension) * It has already been officially implemented. * https://github.com/JustusAdam/language-haskell/pull/49 * Linguist (which is used from github) * Linguis uses language-haskell submodule of atom. * Linguis will bump it at new year release. * Pygments (which is used from trac, readthedocs, pandoc, ...) * This is pending review. * https://bitbucket.org/birkenfeld/pygments-main/pull-requests/745 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: patch Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Comment (by _recursion): I've submitted an issue for this for SublimeHaskell (Sublime Text Haskell plugin) which can be found here: https://github.com/SublimeHaskell/SublimeHaskell/issues/387 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: patch Priority: normal | Milestone: 8.6.1 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: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Comment (by takenobu): _recursion,thank you so much! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores
extension)
-------------------------------------+-------------------------------------
Reporter: takenobu | Owner: takenobu
Type: task | Status: patch
Priority: normal | Milestone: 8.6.1
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: #13126 #9224 | Differential Rev(s): Phab:D4235
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Thanks for taking this on, takenobu! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Comment (by takenobu): It's my pleasure :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: GHCProposal Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => GHCProposal -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14473: Implement Underscores in Numeric Literals Proposal (NumericUnderscores extension) -------------------------------------+------------------------------------- Reporter: takenobu | Owner: takenobu Type: task | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: GHCProposal Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #13126 #9224 | Differential Rev(s): Phab:D4235 Wiki Page: | -------------------------------------+------------------------------------- Comment (by takenobu):
Pygments (which is used from trac, readthedocs, pandoc, ...) This is pending review. https://bitbucket.org/birkenfeld/pygments-main/pull-requests/745
The patch for Pygments has been merged. (Development of Pygments was restarted.) Syntax hightlight for NumericUnderscores, BinaryLiterals and HexFloatLiterals will be available on Pygments, Sphinx, readthedocs and pandoc. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14473#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC