[Template-haskell] TupleT type constructor

Alfonso Acosta alfonso.acosta at gmail.com
Mon Oct 29 07:31:07 EDT 2007


Hi,

I'm a bit confused about TupleT . Is is supposed to be only used when
synthesizing types? (i.e. reify will never output such a type)?

~/ghc/compiler/stage2$ ./ghc-inplace --interactive  -fth
GHCi, version 6.9.20071025: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude>  :m +Language.Haskell.TH
Prelude Language.Haskell.TH> let l = (1,2)
Prelude Language.Haskell.TH> $( do {VarI _ t _ _ <- reify (mkName
"l"); runIO $ putStrLn (pprint t); [| 1 |]})
Loading package array-0.1 ... linking ... done.
Loading package packedstring-0.1 ... linking ... done.
Loading package containers-0.1 ... linking ... done.
Loading package pretty-1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Data.Tuple.(,) GHC.Num.Integer GHC.Num.Integer
Data.Tuple.(,) GHC.Num.Integer GHC.Num.Integer
Data.Tuple.(,) GHC.Num.Integer GHC.Num.Integer
Data.Tuple.(,) GHC.Num.Integer GHC.Num.Integer
1

(The four outputs are a known TH bug)

>From the definition of "Type" I would have expected to get

(TupleT 2 `AppT` ConT "GHC.Num.Integer") `AppT` (ConT "GHC.Num.Integer")

Should this be considered a bug or a feature? IMHO it's quite ugly to
have two valid representations for the same type in the same AST
structure.

Best Regards,

Fons


More information about the template-haskell mailing list