[GHC] #1849: Template Haskell: reify is not consistent with the
special constructors ListT and TupleT
GHC
trac at galois.com
Wed Nov 7 11:24:56 EST 2007
#1849: Template Haskell: reify is not consistent with the special constructors
ListT and TupleT
----------------------+-----------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.1
Severity: normal | Keywords:
Testcase: | Architecture: Unknown
Os: Unknown |
----------------------+-----------------------------------------------------
While reify provides consistent type information for arrows (i.e. returns
the special ArrowT constructor and not ConT "GHC.Prim.(->)"), that doesn't
happen with ListT and TupleT.
{{{
Prelude> :m +Language.Haskell.TH
Prelude Language.Haskell.TH> let seeType n = do {VarI _ t _ _ <- reify n;
runIO $ putStrLn $ show t; [|1|]}
Prelude Language.Haskell.TH> let {f = undefined :: Int -> Int; g =
undefined :: [Int]; h = undefined :: (Int, Int)}
Prelude Language.Haskell.TH> $(seeType (mkName "f"))
AppT (AppT ArrowT (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
AppT (AppT ArrowT (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
AppT (AppT ArrowT (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
AppT (AppT ArrowT (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
1
Prelude Language.Haskell.TH> $(seeType (mkName "g"))
AppT (ConT GHC.Base.[]) (ConT GHC.Base.Int)
AppT (ConT GHC.Base.[]) (ConT GHC.Base.Int)
AppT (ConT GHC.Base.[]) (ConT GHC.Base.Int)
AppT (ConT GHC.Base.[]) (ConT GHC.Base.Int)
1
Prelude Language.Haskell.TH> $(seeType (mkName "h"))
AppT (AppT (ConT Data.Tuple.(,)) (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
AppT (AppT (ConT Data.Tuple.(,)) (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
AppT (AppT (ConT Data.Tuple.(,)) (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
AppT (AppT (ConT Data.Tuple.(,)) (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
1
}}}
For g and h the expected returned types are:
{{{
AppT ListT (ConT GHC.Base.Int)
AppT (AppT (TupleT 2) (ConT GHC.Base.Int)) (ConT GHC.Base.Int)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1849>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list