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,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 457
    • Merge requests 457
  • 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
  • #2994
Closed
Open
Created Jan 31, 2009 by rwbarton@trac-rwbarton

give better error messages for instance declarations with the wrong number of parameters

Consider the following erroneous program which tries to define an instance of MonadReader.

import Control.Monad.Reader

newtype Reader' r a = Reader' (r -> a)

instance MonadReader (Reader' r)

This instance declaration is wrong, because the MonadReader type class has two parameters. But ghc's error message is not very helpful:

/tmp/err.hs:5:21:
    `Reader' r' is not applied to enough type arguments
    Expected kind `*', but `Reader' r' has kind `* -> *'
    In the instance declaration for `MonadReader (Reader' r)'

While if I give too many arguments, e.g., instance MonadReader r r (Reader' r), I always get a good error message, even if the kinds of some of the leading types are wrong:

    Kind error: `MonadReader' is applied to too many type arguments
    In the instance declaration for `MonadReader r r (Reader' r)'

So it'd be great if the error message for giving too few type arguments could be more like that one.

Trac metadata
Trac field Value
Version 6.11
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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