[GHC] #9178: improve orphan instance warning
#9178: improve orphan instance warning ------------------------------------+------------------------------------- Reporter: fphh | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- The current warning `Warning: orphan instance: instance ClassName TypeName` could be improved by suggesting three solutions: (i) Move the instance declaration to the file, where the class has been declared (ii) Move the instance declaration to the file, where the Type has been declared (iii) Wrap the type with a newtype and declare the instance on the new type. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9178: improve orphan instance warning -------------------------------------+------------------------------------ Reporter: fphh | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by fphh): * status: new => patch Comment: Finished, ready for review. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9178: improve orphan instance warning -------------------------------------+------------------------------------ Reporter: fphh | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by fphh): This is how it looks like. What do you think? {{{ T9178.hs:8:10: Warning: Orphan instance: instance Show T9178_Type To avoid this move the instance declaration to the module of the class or of the type, or wrap the type with a newtype and declare the instance on the new type. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9178: improve orphan instance warning -------------------------------------+------------------------------------ Reporter: fphh | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by simonpj): OK with me. Do others like the new error message? It's a user matter not an implementation matter. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9178: improve orphan instance warning -------------------------------------+------------------------------------ Reporter: fphh | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Joachim Breitner <mail@…>): In [changeset:"877a9577280f4b6aa6ef47f7a27d9b741b8234cf/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="877a9577280f4b6aa6ef47f7a27d9b741b8234cf" Better warning message for orphan instances (Ticket #9178) Including a test case. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9178: improve orphan instance warning -------------------------------------+------------------------------------ Reporter: fphh | Owner: Type: task | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by nomeata): * status: patch => closed * resolution: => fixed Comment: Also ok with me. That makes two of us, so I pushed it. Nevertheless: If someone wants to improve it, feel free to do so. Congrats, Heinrich, for your first contribution to GHC, I hope there will be more! :-) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9178: improve orphan instance warning -------------------------------------+------------------------------------ Reporter: fphh | Owner: Type: task | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Joachim Breitner <mail@…>): In [changeset:"707bde533dcb16bf8f5a30179d098b343e54fe7b/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="707bde533dcb16bf8f5a30179d098b343e54fe7b" Update test results with new orphan instance warning It seems that the patch in #9178 was not fully validated. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9178#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC