Skip to content

Suggest ScopedTypeVariables when type variable not in scope

I recently wrote this:

{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE TypeApplications #-}
module B where
f :: forall a. a -> a
f x = id @a x

And was hornswoggled for the better part of five minutes for why "a" wasn't in scope. Answer: you need ScopedTypeVariables. A suggestion would be nice.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC goldfire
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information