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 |