我正在尝试在Real World Haskell中编译一些代码 - 第24章LineCount.hs .
I have not made any changes to the code.
但是,当我这样做时:
ghc -O2 --make -threaded LineCount.hs
(按照书中的说明),我得到的信息是:
MapReduce.hs:6:7: Not in scope: `rnf'
我可能做错了什么?
快速搜索显示,过去的包并行和严格并发存在一些问题,重新安装它们可以解决问题 . 但是,我试过了,它没有用 . 此外,值得注意的是,该问题在2010年的某个时候得到了修复:https://groups.google.com/forum/?fromgroups=#!msg/happs/gOieP4xfpNc/nrasm842JlUJ
注意:在同一章中编译其他文件时,我会收到各种其他错误 . 例如,在编译Strat.hs时,我得到:Module Control.Parallel.Strategies' does not export
parZipWith' . 在编译LineChunks.hs时,我得到:Module Control.Parallel.Strategies' does not export
rnf' .
老实说,作为一名新手Haskell程序员,一旦我开始修改代码,我预计会遇到麻烦 - 但我没想到书中的代码有问题!
1 回答
该函数不再被称为
rnf
. 它现在被称为rdeepseq
. 只需更换它 . :)您可以通过google搜索"control parallel strategies hackage"或单击here在线查找
parallel
包的内容 .