[GHC] #16203: Unhelpful names for wildcard type variables

GHC ghc-devs at haskell.org
Fri Jan 18 16:54:15 UTC 2019


#16203: Unhelpful names for wildcard type variables
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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 at 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?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16203>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list