[GHC] #15596: When a type application cannot be applied to an identifier due to the absence of an explicit type signature, let the error just say so!

GHC ghc-devs at haskell.org
Mon Sep 3 05:37:04 UTC 2018


#15596: When a type application cannot be applied to an identifier due to the
absence of an explicit type signature, let the error just say so!
-------------------------------------+-------------------------------------
           Reporter:  kindaro        |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:
           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 this code:

 {{{#!hs
 {-# language TypeApplications #-}

 module TypeApplicationsErrorMessage where

 f = (+)
 g = f @Integer
 }}}

 This is what happens when I try to compile it:

 {{{#!hs
 % ghc TypeApplicationsErrorMessage.hs
 [1 of 1] Compiling TypeApplicationsErrorMessage (
 TypeApplicationsErrorMessage.hs, TypeApplicationsErrorMessage.o )

 TypeApplicationsErrorMessage.hs:6:5: error:
     • Cannot apply expression of type ‘a0 -> a0 -> a0’
       to a visible type argument ‘Integer’
     • In the expression: f @Integer
       In an equation for ‘g’: g = f @Integer
   |
 6 | g = f @Integer
   |     ^^^^^^^^^^
 }}}

 This error is easily fixed by supplying an explicit type signature to `f`.
 So, perhaps the error message could just say so?

 I am observing this with `The Glorious Glasgow Haskell Compilation System,
 version 8.6.0.20180810`.

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


More information about the ghc-tickets mailing list