[GHC] #675: Bad error message in GHCi

GHC trac at galois.com
Sat Jan 28 04:30:24 EST 2006


#675: Bad error message in GHCi
--------------------------------+-------------------------------------------
    Reporter:  guest            |        Owner:         
        Type:  feature request  |       Status:  new    
    Priority:  normal           |    Milestone:         
   Component:  GHCi             |      Version:  6.4.1  
    Severity:  normal           |     Keywords:         
          Os:  Unknown          |   Difficulty:  Unknown
Architecture:  Unknown          |  
--------------------------------+-------------------------------------------
If
 {{{
 import Test.QuickCheck

 prop_eq_reflexive x = x == x
 }}}
 is loaded into GHCi the following can be observed:
 {{{
 *BadErrorMessage> quickCheck prop_eq_reflexive

 Top level:
     No instance for (Show (IO ()))
       arising from use of `print' at Top level
     Probable fix: add an instance declaration for (Show (IO ()))
     In a 'do' expression: print it
 }}}

 Hugs gives the more understandable error message
 {{{
 BadErrorMessage> quickCheck prop_eq_reflexive
 ERROR - Unresolved overloading
 *** Type       : (Eq a, Show a, Arbitrary a) => IO ()
 *** Expression : quickCheck prop_eq_reflexive
 }}}

 `:t` in GHCi gives an even more understandable error message:
 {{{
 *BadErrorMessage> :t quickCheck prop_eq_reflexive

 <interactive>:1:0:
     Ambiguous type variable `a' in the constraints:
       `Arbitrary a' arising from use of `quickCheck' at
 <interactive>:1:0-9
       `Eq a' arising from use of `prop_eq_reflexive' at <interactive>:1
 :11-27
       `Show a' arising from use of `quickCheck' at <interactive>:1:0-9
     Probable fix: add a type signature that fixes these type variable(s)
 }}}

 (In the introductory FP courses at Chalmers we use Quick``Check from the
 start, so this error message bites students in the first week.)

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


More information about the Glasgow-haskell-bugs mailing list