Skip to content

isInstance does not work for compound types

Consider

import Language.Haskell.TH.Syntax                                                
                                                                                 
data A = A                                                                       
                                                                                 
test :: Q [Dec]                                                                  
test = do                                                                        
  tp <- [t| (Int, A) |]                                                          
  inst1 <- isInstance ''Show [ tp ]                                              
  runIO $ print inst1                                                            
  return []  

This prints True even though there is no Show instance for A (the Show instance it finds is for pairs, but it does not verify that there are Show instances for the pair components).

Trac metadata
Trac field Value
Version 7.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