[GHC] #7856: Wrong error message for unknown Instance

GHC cvs-ghc at haskell.org
Mon Apr 22 15:58:53 CEST 2013


#7856: Wrong error message for unknown Instance
----------------------------------------------+-----------------------------
Reporter:  bas                                |          Owner:                         
    Type:  feature request                    |         Status:  new                    
Priority:  normal                             |      Component:  Compiler (Type checker)
 Version:  7.6.3                              |       Keywords:  Instance               
      Os:  Unknown/Multiple                   |   Architecture:  Unknown/Multiple       
 Failure:  Incorrect warning at compile-time  |      Blockedby:                         
Blocking:                                     |        Related:                         
----------------------------------------------+-----------------------------
 This type-incorrect program gives a wrong error message:

 {{{
 main = tmp "hello"
   where tmp :: String -> IO ()
         tmp = sequence_ lst
         lst = [putStrLn "hi"]
 }}}

 Namely:

 {{{
     Couldn't match expected type `IO ()' with actual type `()'
     Expected type: String -> IO ()
       Actual type: String -> ()
     In the return type of a call of `sequence_'
     In the expression: sequence_ lst
 }}}

 I would not expect the "actual type" to be "String -> ()", but rather "IO
 ()". Note: GHC expects that "(->) String" is a monad.

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



More information about the ghc-tickets mailing list