Skip to content

lookupTypeName does not support type operators not starting with :

The following non-working code (minus a missing import) was posted on stackoverflow:

IssueTH.hs:

{-# LANGUAGE TemplateHaskell #-}
module IssueTH where
import Language.Haskell.TH

f :: Q [Dec]
f = do
    Just n <- lookupTypeName "GHC.TypeLits.*"
    return []

Issue.hs:

{-# LANGUAGE TemplateHaskell #-}
module Issue where
import IssueTH
import GHC.TypeLits

$f

ghc Issue.hs fails with message: Pattern match failure in do expression at IssueTH.hs:7:5-10

This gives no error if * is replaced by an alphanumeric type like Nat. Similar tests seem to fail whenever attempting to look up a type operator with lookupTypeName.

Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC oerjan
Operating system
Architecture
Edited by oerjan@nvg.ntnu.no
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information