#1241: Functional dependencies not checked.
----------------------------------------+-----------------------------------
    Reporter:  guest                    |       Owner:         
        Type:  bug                      |      Status:  new    
    Priority:  normal                   |   Milestone:         
   Component:  Compiler (Type checker)  |     Version:  6.6    
    Severity:  normal                   |    Keywords:         
  Difficulty:  Unknown                  |    Testcase:         
Architecture:  Unknown                  |          Os:  Unknown
----------------------------------------+-----------------------------------
Hello,
 GHC 6.6 (with flags {{{-fglasgow-exts -fallow-undecidable-instances}}}) is
 too liberal when accepting instances.  Here is an example:
 {{{
 class F a b | a -> b where f :: (a,b)
 instance F Int b
 }}}
 The instance violates the functional dependency constraint of {{{F}}}
 because (in theory) it can be used to solve both {{{F Int Bool}}} and {{{F
 Int Char}}}.  In practice, it seems that some free variable gets bound
 upon the first use of {{{f}}} with a concrete type, leading to some rather
 confusing behavior. Example:
 {{{
 x :: (Int,a)
 x = f

 y :: (Int,Bool)
 y = f

 z :: (Int,Char)
 z = x -- works, but 'f' does not
 }}}

 -Iavor

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

Reply via email to