[GHC] #2307: Poor warning for conflicting functional dependencies

View: New views
7 Messages — Rating Filter:   Alert me  

[GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
-----------------------------+----------------------------------------------
    Reporter:  NeilMitchell  |       Owner:          
        Type:  bug           |      Status:  new    
    Priority:  normal        |   Component:  Compiler
     Version:  6.8.2         |    Severity:  normal  
    Keywords:                |    Testcase:          
Architecture:  Unknown       |          Os:  Unknown
-----------------------------+----------------------------------------------
 {{{
 E:\Neil\thesis>ghci obj\haskell2\Proof_default.hs
 GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 [1 of 1] Compiling Proof_default    ( obj/haskell2/Proof_default.hs,
 interpreted
  )

 obj/haskell2/Proof_default.hs:177:0:
     Functional dependencies conflict between instance declarations:
       instance [incoherent] SubstRep
                               (Prop (Sat VarName)) ([VarName], [Expr])
 (Prop (Sa
 t Expr))
         -- Defined at obj/haskell2/Proof_default.hs:177:0-75
       instance [incoherent] SubstRep
                               (Prop (Sat Int)) ([Int], [Expr]) (Prop (Sat
 Expr))

         -- Defined at obj/haskell2/Proof_default.hs:180:0-67
       instance [incoherent] SubstRep
                               (Prop (Sat Int)) ([Int], [Expr]) (Prop (Sat
 Expr))

         -- Defined at obj/haskell2/Proof_default.hs:180:0-67
 Failed, modules loaded: none.
 }}}

 It has listed three items that conflict, but two of the items are actually
 the same. I would expect the error message to {{{nub}}} the list of
 instances first. Sample file attached. This bug may have been fixed in
 HEAD, with the recent warnings patch, but I cannot check (not enough disk
 space!).

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
--------------------------+-------------------------------------------------
 Reporter:  NeilMitchell  |          Owner:            
     Type:  bug           |         Status:  new        
 Priority:  normal        |      Milestone:  6.10 branch
Component:  Compiler      |        Version:  6.8.2      
 Severity:  normal        |     Resolution:            
 Keywords:                |     Difficulty:  Unknown    
 Testcase:                |   Architecture:  Unknown    
       Os:  Unknown       |  
--------------------------+-------------------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown
  * milestone:  => 6.10 branch

Comment:

 Thanks for the report! Here is a minimal testcase:
 {{{
 {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
              OverlappingInstances, UndecidableInstances,
 IncoherentInstances,
              FlexibleInstances #-}

 module Foo where

 class C a b c | a -> b, a -> c
 instance C Int (Maybe String) Float
 instance C Int (Maybe Bool)   Double
 }}}
 With the HEAD:
 {{{
 Proof_default.hs:8:0:
     Functional dependencies conflict between instance declarations:
       instance [incoherent] C Int (Maybe String) Float
         -- Defined at Proof_default.hs:8:0-34
       instance [incoherent] C Int (Maybe Bool) Double
         -- Defined at Proof_default.hs:9:0-35
       instance [incoherent] C Int (Maybe Bool) Double
         -- Defined at Proof_default.hs:9:0-35
 }}}
 Before just nubbing the instances, we should make sure that it's not a bug
 that it is finding the same one multiple times in the first place.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
-----------------------------------------+----------------------------------
 Reporter:  NeilMitchell                 |          Owner:            
     Type:  bug                          |         Status:  closed    
 Priority:  normal                       |      Milestone:  6.10 branch
Component:  Compiler                     |        Version:  6.8.2      
 Severity:  normal                       |     Resolution:  fixed      
 Keywords:                               |     Difficulty:  Unknown    
 Testcase:  typecheck/should_fail/T2307  |   Architecture:  Unknown    
       Os:  Unknown                      |  
-----------------------------------------+----------------------------------
Changes (by simonpj):

  * testcase:  => typecheck/should_fail/T2307
  * status:  new => closed
  * resolution:  => fixed

Comment:

 Excellent, thanks for refining the test case.  That made it easy.

 In fact, nubbing is the right thing, because `FunDeps.badFunDeps` looks
 through the fundeps one by one; in this case there are two, and the same
 instance conflicts with both.

 Fixed by
 {{{
 Tue Jul  1 17:58:30 BST 2008  simonpj@...
   * Fix Trac #2307: need to nub bad fundep reports
 }}}
 Simon

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
-----------------------------------------+----------------------------------
 Reporter:  NeilMitchell                 |          Owner:          
     Type:  bug                          |         Status:  reopened
 Priority:  normal                       |      Milestone:  6.10.1  
Component:  Compiler                     |        Version:  6.8.2  
 Severity:  normal                       |     Resolution:          
 Keywords:                               |     Difficulty:  Unknown
 Testcase:  typecheck/should_fail/T2307  |   Architecture:  Unknown
       Os:  Unknown                      |  
-----------------------------------------+----------------------------------
Changes (by igloo):

  * status:  closed => reopened
  * resolution:  fixed =>
  * milestone:  6.10 branch => 6.10.1

Comment:

 The behaviour when the types in the instances were changed felt a little
 odd to me, so I had a quick look at the code, and I think it's broken;
 e.g. this module:
 {{{
 {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
              OverlappingInstances, UndecidableInstances,
 IncoherentInstances,
              FlexibleInstances #-}

 module Foo where

 class C a b c | b -> c
 instance C Bool Int Float
 instance C Char Int Double
 }}}
 is accepted by GHC, but violates `b -> c`.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
-----------------------------------------+----------------------------------
 Reporter:  NeilMitchell                 |          Owner:          
     Type:  bug                          |         Status:  reopened
 Priority:  normal                       |      Milestone:  6.10.1  
Component:  Compiler                     |        Version:  6.8.2  
 Severity:  normal                       |     Resolution:          
 Keywords:                               |     Difficulty:  Unknown
 Testcase:  typecheck/should_fail/T2307  |   Architecture:  Unknown
       Os:  Unknown                      |  
-----------------------------------------+----------------------------------
Comment (by simonpj):

 crumbs, good catch Ian.  You are referring to `FunDeps.trimRoughMatchTcs`?
 Indeed that looks wrong: it should match on the `ls` rather than
 everything except `rs`.

 Is that what you meant, or did you have something else in mind?

 Simon

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
-----------------------------------------+----------------------------------
 Reporter:  NeilMitchell                 |          Owner:          
     Type:  bug                          |         Status:  reopened
 Priority:  normal                       |      Milestone:  6.10.1  
Component:  Compiler                     |        Version:  6.8.2  
 Severity:  normal                       |     Resolution:          
 Keywords:                               |     Difficulty:  Unknown
 Testcase:  typecheck/should_fail/T2307  |   Architecture:  Unknown
       Os:  Unknown                      |  
-----------------------------------------+----------------------------------
Comment (by igloo):

 I can't think of a case where just-ls won't work, so that sounds right to
 me!

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2307: Poor warning for conflicting functional dependencies

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2307: Poor warning for conflicting functional dependencies
----------------------------------------------------+-----------------------
 Reporter:  NeilMitchell                            |          Owner:        
     Type:  bug                                     |         Status:  closed
 Priority:  normal                                  |      Milestone:  6.10.1
Component:  Compiler                                |        Version:  6.8.2  
 Severity:  normal                                  |     Resolution:  fixed  
 Keywords:                                          |     Difficulty:  Unknown
 Testcase:  typecheck/should_fail/T2307, tcfail202  |   Architecture:  Unknown
       Os:  Unknown                                 |  
----------------------------------------------------+-----------------------
Changes (by igloo):

  * testcase:  typecheck/should_fail/T2307 => typecheck/should_fail/T2307,
               tcfail202
  * status:  reopened => closed
  * resolution:  => fixed

Comment:

 I've made the change and added a test: tcfail202

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2307#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
LightInTheBox - Buy quality products at wholesale price!