[GHC] #12702: Don't warn about redundant constraints for necessary

#12702: Don't warn about redundant constraints for necessary -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.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: -------------------------------------+------------------------------------- In the attached example, GHC warns that the constraint on line 16 of Main.hs is redundant. {{{ • Redundant constraint: e ~ FGCD r s • In the type signature for: foo :: (e ~ FGCD r e', e' ~ (e * (s / r)), e ~ FGCD r s) => Proxy s -> Proxy r -> () }}} However, when I remove that constraint, I get the following error: {{{ • Occurs check: cannot construct the infinite type: t0 ~ Factored.FMul (FGCD r t0) (Factored.FDiv s r) The type variable ‘t0’ is ambiguous • In the ambiguity check for ‘foo’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the type signature: foo :: forall e e' r s. (e ~ FGCD r e', e' ~ (e * (s / r))) => Proxy s -> Proxy r -> () }}} I'm not entirely sure if the error is correct or not; I can't figure out what it's getting on about. So: if the constraint is required to make `foo` compile, then it is most certainly ''not'' redundant, and there shouldn't be a warning suggesting its removal. If the constraint really isn't required, then the error is a bug. (I apologize for the second bug involving singletons in as many days; I simply don't know an easy way to remove that dependency.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12702 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12702: Don't warn about redundant constraints for necessary -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.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 crockeea): * Attachment "bug.tar.gz" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12702 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12702: Don't warn about redundant constraints for necessary -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.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):
So: if the constraint is required to make foo compile, then it is most certainly not redundant, and there shouldn't be a warning suggesting its removal.
Correct. But I can't reproduce this error either with HEAD or with the 8.0 branch (which has zillions of bugs fixed wrt 8.0.1). Could you see if you get the warning with either of those? You'll need to ask for `-Wredundant-constraints` explicitly, because it's no longer in `-Wall`. Thanks -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12702#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12702: Don't warn about redundant constraints for necessary -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.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 crockeea): If you can't reproduce with 8.0 branch, then I'd say it has been fixed by some other change. I'll let you close just in close just in case you want to add a regression test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12702#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12702: Don't warn about redundant constraints for necessary -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.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 RyanGlScott): * status: new => closed * resolution: => fixed * milestone: => 8.0.2 Comment: I can't reproduce the warning on GHC 8.0.2. Sadly, this test case requires lots of `singletons` machinery, which is darn-near impossible to boil down to a simple test case. I'm going to just close this as being fixed in 8.0.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12702#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC