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
  • #16203
Closed
Open
Created Jan 18, 2019 by Simon Peyton Jones@simonpjDeveloper

Unhelpful names for wildcard type variables

Consider

{-# LANGUAGE PartialTypeSignatures #-}

f :: _ -> _
f x = x

With GHC 8.6 we got

T16152.hs:10:6: warning: [-Wpartial-type-signatures]
    • Found type wildcard ‘_’ standing for ‘w’
      Where: ‘w’ is a rigid type variable bound by
               the inferred type of f :: w -> w
               at T16152.hs:11:1-7
    • In the type signature: f :: _ -> _
   |
10 | f :: _ -> _
   |      ^

T16152.hs:10:11: warning: [-Wpartial-type-signatures]
    • Found type wildcard ‘_’ standing for ‘w’
      Where: ‘w’ is a rigid type variable bound by
               the inferred type of f :: w -> w
               at T16152.hs:11:1-7
    • In the type signature: f :: _ -> _
   |
10 | f :: _ -> _
   |           ^

But with HEAD we get

T16152.hs:10:6: warning: [-Wpartial-type-signatures]
    • Found type wildcard ‘_’ standing for ‘_’
      Where: ‘_’ is a rigid type variable bound by
               the inferred type of f :: _ -> _
               at T16152.hs:11:1-7
    • In the type ‘_ -> _’
      In the type signature: f :: _ -> _
   |
10 | f :: _ -> _
   |      ^

T16152.hs:10:11: warning: [-Wpartial-type-signatures]
    • Found type wildcard ‘_’ standing for ‘_’
      Where: ‘_’ is a rigid type variable bound by
               the inferred type of f :: _ -> _
               at T16152.hs:11:1-7
    • In the type ‘_ -> _’
      In the type signature: f :: _ -> _
   |
10 | f :: _ -> _
   |           ^

Saying "Found type wildcard ‘’ standing for ‘’" is unhelpful. The "w" form is much better.

The change is caused by

commit 17bd163566153babbf51adaff8397f948ae363ca
Author: mynguyen <mnguyen1@brynmawr.edu>
Date:   Tue Dec 18 11:52:26 2018 -0500

    Visible kind application

which has this patch

-newWildTyVar _name
+newWildTyVar
   = do { kind <- newMetaKindVar
        ; uniq <- newUnique
        ; details <- newMetaDetails TauTv
-       ; let name = mkSysTvName uniq (fsLit "w")
+       ; let name = mkSysTvName uniq (fsLit "_")
              tyvar = (mkTcTyVar name kind details)
        ; traceTc "newWildTyVar" (ppr tyvar)
        ; return tyvar }

What was the reason for this change? Can we change "_" back to "w" please?

Trac metadata
Trac field Value
Version 8.6.3
Type Bug
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