[GHC] #14774: Recusive superclass epansion is over-keen
#14774: Recusive superclass epansion is over-keen -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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: -------------------------------------+------------------------------------- Consider this, with `RecursiveSuperClasses`: {{{ class C a => D a where cop :: a -> a class D a => C a where dop :: a -> a g :: C a => a -> Bool g x = g x f :: C a => a -> Bool f x = g x }}} When we compile this we get {{{ f = \ (@ a_aXf) ($dC_aXh :: C a_aXf) (eta_B1 :: a_aXf) -> g @ a_aXf (Foo.$p1D @ a_aXf (Foo.$p1C @ a_aXf $dC_aXh)) eta_B1 }}} Notice the ridiculous double superclass selection from `$dC_aXh`. It's not wrong, just stupid! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14774> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14774: Recusive superclass epansion is over-keen -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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:"65069806ea3637882d584e785dcb9e650271e4b6/ghc" 65069806/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="65069806ea3637882d584e785dcb9e650271e4b6" Fix solveOneFromTheOther for RecursiveSuperclasses This patch fixes the redundant superclass expansion in Trac #14774. The main change is to fix TcInterac.solveOneFromTheOther, so that it does not prefer a work-item with a binding if that binding transitively depends on the inert item we are comparing it with. Explained in Note [Replacement vs keeping] in TcInert, esp item (c) of the "Constraints coming from the same level" part. To make this work I refactored out a new function TcEvidence.findNeededEvVars, which was previously buried inside TcSimplify.neededEvVars. I added quite a few more comments and signposts about superclass expansion. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14774#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14774: Recusive superclass epansion is over-keen -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_compile/T14774 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_compile/T14774 * resolution: => fixed Comment: No need to merge. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14774#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC