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 461
    • Merge requests 461
  • 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
  • #19491
Closed
Open
Created Mar 05, 2021 by Richard Eisenberg@raeDeveloper

Obscure type error message around kinds needs more information to be useful

If I say

{-# LANGUAGE PolyKinds #-}

module Bug where

import GHC.Exts

fTerm :: (Any :: TYPE r)
fTerm = undefined

then I get

Bug.hs:7:10: error:
    • Quantified type's kind mentions quantified type variable
        type: ‘Any’
      where the body of the forall has this kind: ‘TYPE r’
    • In the type signature: fTerm :: (Any :: TYPE r)
  |
7 | fTerm :: (Any :: TYPE r)
  |          ^^^^^^^^^^^^^^^

This is true enough. But it's hard to action on. Much better would be

Bug.hs:7:10: error:
    • Quantified type's kind mentions quantified type variable
        type: ‘forall (r :: RuntimeRep). Any @(TYPE r)’
      where the body of the forall has this kind: ‘TYPE r’
    • In the type signature: fTerm :: (Any :: TYPE r)
  |
7 | fTerm :: (Any :: TYPE r)
  |          ^^^^^^^^^^^^^^^

This new message requires -fprint-explicit-foralls -fprint-explicit-kinds -fprint-explicit-runtime-reps. Any time this message is printed, all three of these dark corners will be in play, so let's just make them all unconditionally explicit.

Edited Mar 05, 2021 by Richard Eisenberg
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking