#5577: Two arguments are not two arguments according to the type checker
---------------------------------+------------------------------------------
    Reporter:  josef             |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler (Type checker)
     Version:  7.0.3             |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown           
---------------------------------+------------------------------------------
 I got a very strange type error message from GHC today. I've inserted it
 at the end of this message. It is misleading because it complains that a
 "lambda expression [...] has two arguments, but its type [...] has only
 two". Now, I know that the code contains type errors but the error message
 could be more helpful.

 The code fragment which provokes this message looks as follows:
 {{{
 let writeElement = case ty of
                     Core.FloatType ->
                      \ix element -> tell [loc :!: ix := LitF element]
 }}}
 The `Core.FloatType` constructor is part of a GADT, the case ought to
 refine the type of `element` to `Float`. I don't know if that's what's
 tripping GHC up. The actual error has to do with the type of `ix` which
 should be of type `Expr` but the function `writeElement` is applied to an
 argument of type `Integer`.

 The error message:
 {{{
     Couldn't match type `Expr' with `Integer'
     The lambda expression `\ ix element -> tell ...' has two arguments,
     but its type `Integer
                   -> b0
                   -> RWST () [Prog] Integer Data.Functor.Identity.Identity
 c0'
     has only two
     In the expression:
       \ ix element -> tell [loc :!: ix := LitF element]
     In a case alternative:
         Core.FloatType -> \ ix element -> tell [loc :!: ix := LitF
 element]
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5577>
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