[GHC] #13759: Strange error message for deriving Data

#13759: Strange error message for deriving Data -------------------------------------+------------------------------------- Reporter: alanz | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 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 following code {{{#!hs {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE FlexibleInstances #-} import Data.Data data Pass = Parsed | Renamed | Typechecked deriving (Data) data GHC (c :: Pass) deriving instance Data (GHC 'Parsed) deriving instance Data (GHC 'Renamed) deriving instance Data (GHC 'Typechecked) -- Type synonyms as a shorthand for tagging type GhcPs = GHC 'Parsed type GhcRn = GHC 'Renamed type GhcTc = GHC 'Typechecked }}} loads fine in `ghci-8.2.0.20170507`. In `ghc-8.0.2` and current master (as at https://github.com/ghc/ghc/tree/wip/new-tree-one-param-2) it gives {{{#!hs alanz@alanz-laptop:~/tmp/ghc-bug-data-deriving$ ghci-8.0.2 Main.hs GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/alanz/.ghci [1 of 1] Compiling Main ( Main.hs, interpreted ) Main.hs:16:1: error: Multiple declarations of ‘$tFl4AgeEJ0Vk5ONrnm56S3r’ Declared at: Main.hs:16:1 Main.hs:17:1 Main.hs:16:1: error: Multiple declarations of ‘$tFl4AgeEJ0Vk5ONrnm56S3r’ Declared at: Main.hs:15:1 Main.hs:17:1 Main.hs:16:1: error: Duplicate type signatures for ‘$tFl4AgeEJ0Vk5ONrnm56S3r’ at Main.hs:15:1-36 Main.hs:16:1-37 Main.hs:17:1-41 Failed, modules loaded: none. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13759 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13759: Strange error message for deriving Data -------------------------------------+------------------------------------- Reporter: alanz | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12245 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #12245 Comment: I'm not sure what changes you did on your local branch to make this fail, but on GHC HEAD (as of commit 09d5c993aae208e3d34a9e715297922b6ea42b3f), that program typechecks. Do you have commit 895eefa8447a2886e77fdedcbca8047263c88db7 (Make unique auxiliary function names in deriving) in your local branch? That's what fixed #12245, which I would consider this ticket to be a duplicate of. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13759#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13759: Strange error message for deriving Data -------------------------------------+------------------------------------- Reporter: alanz | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12245 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): alanz helped me figure out what was going on. You won't hit the bug with the original code, but you will with this slightly tweaked code: {{{#!hs {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE FlexibleInstances #-} import Data.Data data Pass = Parsed | Renamed | Typechecked deriving (Data) data GHC (c :: Pass) deriving instance Data GhcPs deriving instance Data GhcRn deriving instance Data GhcTc -- Type synonyms as a shorthand for tagging type GhcPs = GHC 'Parsed type GhcRn = GHC 'Renamed type GhcTc = GHC 'Typechecked }}} Crucially, we're deriving instances for the type synonyms. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13759#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13759: Strange error message for deriving Data -------------------------------------+------------------------------------- Reporter: alanz | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12245 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate Comment: Please ignore what I wrote in comment:2, that is utter garbage. The real, //real// cause of what was going on is much simpler: it is indeed a duplicate of #12245. The reason that alanz hit this bug when building https://github.com/ghc/ghc/tree/wip/new-tree-one-param-2 was simply because he was bootstrapping with GHC 8.0.2, and the fix for #12245 didn't land until GHC 8.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13759#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13759: Strange error message for deriving Data -------------------------------------+------------------------------------- Reporter: alanz | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: duplicate | Keywords: deriving Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12245 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => deriving -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13759#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC