[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 <simonpj@…>): In [changeset:"10fab31211961c9200d230556ec7742e07a6c831/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="10fab31211961c9200d230556ec7742e07a6c831" Don't report instance constraints with fundeps as redundant More subtlety due to functional dependencies. Note [Redundant constraints in instance decls] in TcErrors. Fixes Trac #10100. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10100#comment:3> 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: 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 <simonpj@…>): In [changeset:"4293a80a3ea835412737911bcb2a6703e9af378b/ghc" 4293a80a/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="4293a80a3ea835412737911bcb2a6703e9af378b" Accommodate API change in transSuperClasses In this patch commit 6eabb6ddb7c53784792ee26b1e0657bde7eee7fb Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Tue Dec 15 14:26:13 2015 +0000 Allow recursive (undecidable) superclasses I changed (transSuperClasses p) to return only the superclasses of p, but not p itself. (Previously it always returned p as well.) The use of transSuperClasses in TcErrors.warnRedundantConstraints really needs 'p' in the result -- but I faild to fix this call site, and instead crippled the test for Trac #10100. This patch sets things right * Accomodates the API change * Re-enables T10100 * And thereby fixes Trac #11474 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10100#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC