A little confused by the results that I get. Using the following:
GHCi, version 7.4.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :m + Language.Haskell.TH
I get this successful result:
Prelude Language.Haskell.TH> runQ [d| data X = X |] [DataD [] X_0 [] [NormalC X_1 []] []]
But I get this error:
Prelude Language.Haskell.TH> runQ [d| data X = X deriving Show |] <interactive>:4:30: The exact Name `X' is not in scope Probable cause: you used a unique name (NameU) in Template Haskell but did not bind it In the Template Haskell quotation [d| data X = X deriving (Show) |] In the first argument of `runQ', namely `[d| data X = X deriving (Show) |]' In the expression: runQ [d| data X = X deriving (Show) |]
Can't I get Show when using Template Haskell?
me2
source share