Skip to content

Warn about badly staged types

Consider an example:

% ghci-9.6.2                              
GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help
Prelude> :set -XTemplateHaskell
Prelude> :m +Data.Proxy Language.Haskell.TH
Prelude Data.Proxy Language.Haskell.TH> let tardy :: forall a. Proxy a -> IO Type; tardy _ = [t| a |]
Prelude Data.Proxy Language.Haskell.TH> tardy (Proxy @Int)
VarT a_6989586621679012786

That's most likely not what user expects. I'd expect that to print the same as

Prelude Data.Proxy Language.Haskell.TH> [t| Int |]
ConT GHC.Types.Int

But someone might be relying on this, so I propose to first introduce a warning and see if those stage errors exist (it could be warning with default error level, but AFAIK we don't yet have precedent for such warnings).

Edited by Oleg Grenrus
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information