[GHC] #671: GHC can suggest "Probable fixes" that are impossible

GHC trac at galois.com
Wed Jan 25 09:23:46 EST 2006


#671: GHC can suggest "Probable fixes" that are impossible
--------------------------------+-------------------------------------------
    Reporter:  glasser at mit.edu  |        Owner:         
        Type:  bug              |       Status:  new    
    Priority:  low              |    Milestone:         
   Component:  Compiler         |      Version:  6.4.1  
    Severity:  minor            |     Keywords:         
          Os:  Unknown          |   Difficulty:  Unknown
Architecture:  Unknown          |  
--------------------------------+-------------------------------------------
Let's say I type in ["foo", 4] to GHCI:

 Prelude> ["foo", 4]

 <interactive>:1:8:
     No instance for (Num [Char])
       arising from the literal `4' at <interactive>:1:8
     Probable fix: add an instance declaration for (Num [Char])
     In the list element: 4
     In the definition of `it': it = ["foo", 4]

 It suggests a "Probable fix": add an instance declaration for (Num
 [Char]).  OK, great.  However, as soon as I try to evaluate "instance Num
 [Char] where" I get

     Illegal instance declaration for `Num [Char]'
         (The instance type must be of form (T a b c)
          where T is not a synonym, and a,b,c are distinct type variables)
     In the instance declaration for `Num [Char]'

 Now, I'm not enough of an expert on the type class system to know if this
 means that it's absolutely impossible to declare instances on [Char], but
 it certainly seems like that.  Thus, the "Probable fix" is in error, since
 [Char] can't get a Num instance.  (Though I guess (Num a) => [a] can, so
 maybe this whole issue is a little moot.)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/671>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list