Skip to content

Template Haskell incorrectly reifies `type data` declaration as DataD rather than TypeDataD

Compiling this file with GHC 9.6.1-alpha1:

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeData #-}
module Main (main) where

import Language.Haskell.TH

type data T

$(pure [])

main :: IO ()
main = putStrLn $(reify ''T >>= stringE . show)

Will print the following output:

$ runghc-9.6.0.20230111 Foo.hs
TyConI (DataD [] Main.T [] Nothing [] [])

I believe that should display TypeDataD, not DataD.

This might be related to #22818 (closed), although I believe they are separate bugs.

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