Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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 4,831
    • Issues 4,831
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #18817

Closed
Open
Created Oct 07, 2020 by Richard Eisenberg@raeDeveloper

Incorrect location of variables in pattern bindings

If we write

f :: a -> b
(f) = \x -> (x :: a)

(NB: a pattern binding) we see that GHC reports the location of a as being bound on the line defining f, not its signature:

/Users/rae/temp/Bug2.hs:2:14: error:
    • Couldn't match expected type ‘a1’ with actual type ‘a’
      ‘a1’ is a rigid type variable bound by
        an expression type signature:
          forall a1. a1
        at /Users/rae/temp/Bug2.hs:2:19
      ‘a’ is a rigid type variable bound by
        the inferred type of f :: a -> b
        at /Users/rae/temp/Bug2.hs:2:1-20
    • In the expression: x :: a
      In the expression: \ x -> (x :: a)
      In a pattern binding: (f) = \ x -> (x :: a)
    • Relevant bindings include
        x :: a (bound at /Users/rae/temp/Bug2.hs:2:8)
        f :: a -> b (bound at /Users/rae/temp/Bug2.hs:2:2)
  |
2 | (f) = \x -> (x :: a)
  |              ^

The key bit is the binding for the variable a in this message, on line 2. It should be line 1.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking