Skip to content

`Language.Haskell.TH.Syntax.reify` returns * rather than Constraint

This module is sufficient to demonstrate the mistake:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where

import Data.Kind
import Data.Proxy
import Language.Haskell.TH

foo :: forall (k :: Constraint). Proxy k
foo = Proxy

return [] -- delimit declaration groups

main :: IO ()
main = putStrLn $(do
  VarI _ ty _ <- reify 'foo
  let p = pprint ty
  [| p |])

Running this in GHC 8.0.2 correctly prints out forall (k_0 :: Constraint) . Data.Proxy.Proxy k_0, but GHC 8.2.2 and 8.4.2 both print forall (k_0 :: *) . Data.Proxy.Proxy k_0.

Trac metadata
Trac field Value
Version 8.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
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