Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,249
    • Issues 5,249
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 576
    • Merge requests 576
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5577
Closed
Open
Issue created Oct 24, 2011 by josef@trac-josef

Two arguments are not two arguments according to the type checker

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]
Trac metadata
Trac field Value
Version 7.0.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking