Skip to content

Template Haskell applies too many arguments to kind synonym

Running the following code:

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeInType #-}
module IdStarK where

import Data.Kind
import Language.Haskell.TH

type Id a = a
data Proxy (a :: Id k) = Proxy

$(return [])

main :: IO ()
main = do
  putStrLn $(reify ''Proxy >>= stringE . pprint)
  putStrLn $(reify ''Proxy >>= stringE . show)

Gives a result I wouldn't have expected:

$ /opt/ghc/head/bin/runghc IdStarK.hs 
data IdStarK.Proxy (a_0 :: IdStarK.Id * k_1) = IdStarK.Proxy
TyConI (DataD [] IdStarK.Proxy [KindedTV a_1627394516 (AppT (AppT (ConT IdStarK.Id) StarT) (VarT k_1627394515))] Nothing [NormalC IdStarK.Proxy []] [])

From the output, it appears that Id is being applied to two arguments, both * and k! Perhaps this indirectly (or directly) a consequence of #11376 (closed)?

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