Skip to content

GitLab

  • Menu
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 4,865
    • Issues 4,865
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • 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 Compiler
  • GHCGHC
  • Issues
  • #21393
Closed
Open
Created Apr 14, 2022 by Syed Akber Jafri@psilospore

Suggest to use the where keyword for a typeclass instance when it's missing

Motivation

When I forget to add the where keyword when I create a typeclass instance I get a confusing error message.

module Example where

instance Show
  show = undefined
> [14 of 15] Compiling Example
> 
> project/src/Example.hs:4:8: error: parse error on input ‘=’
>   |
> 4 |   show = undefined

Proposal

Describe your proposed feature here.

I think the error message could be improved by suggesting that I may have missed the where keyword.

For example:

> [14 of 15] Compiling Example
> 
> project/src/Example.hs:4:8: error: parse error on input ‘=’
>   |
> 4 |   show = undefined

Perhaps you meant:
instance Show where
  show = undefined
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking