Opened 17 months ago

Last modified 13 months ago

#15596 new feature request

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!

Reported by: kindaro Owned by:
Priority: normal Milestone: 8.10.1
Component: Compiler (Type checker) Version: 8.4.3
Keywords: TypeApplications Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Poor/confusing error message Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Consider this code:

{-# language TypeApplications #-}

module TypeApplicationsErrorMessage where

f = (+)
g = f @Integer

This is what happens when I try to compile it:

% 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

Change History (3)

comment:1 Changed 17 months ago by goldfire

This is most certainly a reasonable request. I don't have time right now to look into how hard this would be to arrange, though...

comment:2 Changed 17 months ago by RyanGlScott

Component: CompilerCompiler (Type checker)
Keywords: TypeApplications added
Milestone: 8.8.1
Type of failure: None/UnknownPoor/confusing error message
Version: 8.4.3

comment:3 Changed 13 months ago by osa1


Bumping milestones of low-priority tickets.

Note: See TracTickets for help on using tickets.