[GHC] #1221: Types don't match expressions in type error

GHC trac at galois.com
Tue Mar 13 16:14:38 EDT 2007


#1221: Types don't match expressions in type error
----------------------------------------+-----------------------------------
    Reporter:  igloo                    |       Owner:         
        Type:  bug                      |      Status:  new    
    Priority:  normal                   |   Milestone:  6.6.2  
   Component:  Compiler (Type checker)  |     Version:  6.6    
    Severity:  normal                   |    Keywords:         
  Difficulty:  Unknown                  |    Testcase:         
Architecture:  Unknown                  |          Os:  Unknown
----------------------------------------+-----------------------------------
Frederik Eaton points out in the thread starting
 http://www.haskell.org/pipermail/glasgow-haskell-bugs/2007-
 March/008748.html
 that with this program:

 {{{
 a x = x True ++ [1]

 -- ok
 b = a (const [2])

 -- uninformative error message
 c = a y

 -- more informative
 d = a ()

 y = const ()
 }}}

 in the type error, for b the type doesn't match the expression: y has type
 `a -> ()` but it claims to have infered () for it:

 {{{
 v.hs:8:6:
     Couldn't match expected type `[a]' against inferred type `()'
     In the first argument of `a', namely `y'
     In the expression: a y
     In the definition of `c': c = a y
 }}}

 (this example should be made into a testcase once we know what the error
 will look like).

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


More information about the Glasgow-haskell-bugs mailing list