Skip to content

TypeApplications obscure "Variable not in scope" error message

Compiling

{-# LANGUAGE TypeApplications #-}

module Foo where

foo = bar @Int

gives

Foo.hs:5:7: error:
    • Cannot apply expression of type ‘t1’
      to a visible type argument ‘Int’
    • In the expression: bar @Int
      In an equation for ‘foo’: foo = bar @Int

instead of:

Foo.hs:5:7: error: Variable not in scope: bar

This makes a potential typo appear like a typing error (no pun intended). If we delete @Int, the second message is given.

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