[GHC] #14347: Top-level RecordWildCards no longer working.
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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: -------------------------------------+------------------------------------- {{{#!hs $ ghc -fforce-recomp /tmp/Damn.hs /tmp/T.hs [1 of 2] Compiling Damn ( /tmp/Damn.hs, /tmp/Damn.o ) [2 of 2] Compiling T ( /tmp/T.hs, /tmp/T.o ) /tmp/T.hs:7:5: warning: [-Wmissing-fields] • Fields of ‘D.D’ not initialised: x, y • In the expression: D.D {..} In an equation for ‘d’: d = D.D {..} | 7 | d = D.D {..} | ^^^^^^^^ $ cat /tmp/Damn.hs /tmp/T.hs module Damn (D(..)) where data D = D { x :: Int, y :: () } {-# LANGUAGE RecordWildCards #-} module T where import qualified Damn as D d :: D.D d = D.D {..} x :: Int x = 7 y :: () y = () $ ghc --version The Glorious Glasgow Haskell Compilation System, version 8.2.1 }}} Meanwhile on 8.0 {{{#!hs $ ghc -Wall -fforce-recomp /tmp/Damn.hs /tmp/T.hs [1 of 2] Compiling Damn ( /tmp/Damn.hs, /tmp/Damn.o ) [2 of 2] Compiling T ( /tmp/T.hs, /tmp/T.o ) $ ghc --version The Glorious Glasgow Haskell Compilation System, version 8.0.2 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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: | -------------------------------------+------------------------------------- Changes (by Fuuzetsu): * Attachment "T.hs" added. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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: | -------------------------------------+------------------------------------- Changes (by Fuuzetsu): * Attachment "Damn.hs" added. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: adamgundry (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: adamgundry (removed) * cc: simonpj (added) Comment: Oh, it turns out this breakage was intentional! It was caused by commit 2f8cd14fe909a377b3e084a4f2ded83a0e6d44dd: {{{ From 2f8cd14fe909a377b3e084a4f2ded83a0e6d44dd Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones <simonpj@microsoft.com> Date: Thu, 23 Jun 2016 09:02:00 +0100 Subject: [PATCH] Narrow the use of record wildcards slightly In reviewing the fix to Trac #12130 I found the wild-card fill-in code for ".." notation in record constructions hard to understand. It went to great contortions (including the find_tycon code) to allow data T = C { x, y :: Int } f x = C { .. } to expand to f x = C { x = x, y = y } where 'y' is an /imported function/! That seems way over the top for what record wildcards are supposed to do. So I have narrowed the record-wildcard expansion to include only /locally-bound/ variables; i.e. not top level, and certainly not imported. I don't think anyone is using record wildcards in this bizarre way, so I don't expect any fallout. Even if there is, you can easily initialise fields with eponymous but imported values by hand. An intermediate position would be to allow /local/ top-level definitions. But I doubt anyone is doing that either. Let's see if there's any fallout. It's a local change, easy to revert, so I've just gone ahead to save everyone's time. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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 simonpj): OK so it looks as if I made this change just before the GHC proposals process kicked off. If you think it's desirable for record wildcards to fill-in with top- level, or even imported, bindings, I suggest you write a short proposal to advocate for it. That way we'll get some debate. However, the absence of documentation of this property is bad. I'll add a paragraph about that anyway; we can always modify it if the GHC proposals process agrees a change. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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 Fuuzetsu): I highly dislike {{{RecordWildCards}}} and find its usage at the top-level especially disgusting though I know some that would disagree. *Personally* I am happy to not have this mis-feature but would like to request that the change is documented in GHC docs in the section about the extension. If that's done, please feel free to close the ticket, thanks! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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 Simon Peyton Jones <simonpj@…>): In [changeset:"e375bd350bc9e719b757f4dc8c907c330b26ef6e/ghc" e375bd35/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="e375bd350bc9e719b757f4dc8c907c330b26ef6e" Update record-wildcard docs This patch clarifies the story for record wildcards, following the discussion on Trac #14347. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: new Priority: normal | 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 Fuuzetsu): I think we can close this? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14347: Top-level RecordWildCards no longer working. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 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: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Fuuzetsu): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14347#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC