[GHC] #10100: Bogus "redundant constraint" warning with functional dependencies

#10100: Bogus "redundant constraint" warning with functional dependencies -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Compiling this code with GHC HEAD: {{{#!hs {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} module T10100 where data Zero data Succ a class Add a b ab | a b -> ab, a ab -> b instance Add Zero b b instance (Add a b ab) => Add (Succ a) b (Succ ab) }}} Gives a bogus warning about redundant constraint: {{{ Redundant constraint: Add a b ab In the instance declaration for ‘Add (Succ a) b (Succ ab)’ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10100 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10100: Bogus "redundant constraint" warning with functional dependencies -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by jstolarek): * owner: => simonpj * milestone: => 7.10.1 Comment: I believe that: * this should be fixed in GHC 7.10. I'm setting milestone to 7.10.1 but if there's no time to fix it for 7.10.1 release then please punt it to 7.10.2 * Simon implemented this check, so I'm setting owner to simonpj. Simon, I hope this is correct but if not then please unassign yourself. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10100#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10100: Bogus "redundant constraint" warning with functional dependencies -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): Humph. In one sense the constraint IS redundant: you simply don't need the evidence (dictionary) for `Add a b ab` to create evidence for `Add (Succ a) b (Succ ab)`. But you want nevertheless to allow this (or not warn about it), because you want to prove things like `Add (Succ Zero) beta (Succ Zero)`, by unifying `beta := Zero`. That won't happen unless you generate the constraint `Add Zero beta Zero`. Hmm, well I suppose we should suppress the warnings where there are functional dependencies. I'll work on it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10100#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10100: Bogus "redundant constraint" warning with functional dependencies
-------------------------------------+-------------------------------------
Reporter: jstolarek | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone: 7.10.1
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#10100: Bogus "redundant constraint" warning with functional dependencies -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: simonpj Type: bug | Status: merge Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | typecheck/should_compile/T10100 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => merge * testcase: => typecheck/should_compile/T10100 Comment: I've fixed this and added the example as a test. Merge to 7.10 Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10100#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10100: Bogus "redundant constraint" warning with functional dependencies -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: simonpj Type: bug | Status: closed Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | typecheck/should_compile/T10100 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed * milestone: 7.10.1 => 7.12.1 Comment: Actually, after spending a second trying to merge this, I realized something very silly - `-fwarn-redundant-constraints` isn't in GHC 7.10 anyway! So, this can be closed I think. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10100#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10100: Bogus "redundant constraint" warning with functional dependencies
-------------------------------------+-------------------------------------
Reporter: jstolarek | Owner: simonpj
Type: bug | Status: closed
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.11
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| typecheck/should_compile/T10100
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones
participants (1)
-
GHC