【发布时间】:2016-11-03 18:01:14
【问题描述】:
我正在尝试将一些代码的执行转移到 GHC 8 的编译时间和
template-haskel-2.11。代码如下所示:
myThHelper :: FilePath -> Q Exp
myThHelper path =
runIO (compileThatFile path) >>= liftData
这是该代码的简化版本,但它希望能传达我的意思 努力去做。
注意
liftData
功能,它是template-haskell-2.11 中的新功能,它承诺“提升”到
表达Data 的任何实例。非常酷,它可以编译。
但是,当我这样使用它时:
main :: IO ()
main = do
let compiled = $(myThHelper "/path/to/my/file/foo.txt")
…
我从编译器收到以下错误消息:
• Can't find interface-file declaration for variable Data.Text.Internal.pack
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
• In the first argument of ‘PName’, namely
‘Data.Text.Internal.pack ((:) 'f' ((:) 'o' ((:) 'o' [])))’
In the first argument of ‘Template’, namely
‘PName (Data.Text.Internal.pack ((:) 'f' ((:) 'o' ((:) 'o' []))))’
In the expression:
等等。知道发生了什么以及如何解决吗?
我通过实验证实,只有当要提升的数据类型包含 Text 时,问题才会出现。我要打开一个问题。
【问题讨论】: