Real World Haskell code not compiling?

I'm trying to compile some code in Real World Haskell - Chapter 24. LineCount.hs.

I have not made any changes to the code.

However, when I do:

ghc -O2 --make -threaded LineCount.hs

(as instructed in the book), I get the message:

MapReduce.hs:6:7: Not in scope: `rnf'

What might I be doing wrong?

A quick search showed up that there was some trouble with the packages parallel and strict-concurrency in the past, and that reinstalling them would fix the issue. However, I tried that and it didn't work. Moreover, it is noted there that that issue was fixed sometime in 2010: https://groups.google.com/forum/?fromgroups=#!msg/happs/gOieP4xfpNc/nrasm842JlUJ

Note: I get various other errors when compiling other files in the same chapter. For example, on compiling Strat.hs I get: Module Control.Parallel.Strategies' does not export parZipWith'. On compiling LineChunks.hs I get: Module Control.Parallel.Strategies' does not export rnf'.

Honestly, as a novice Haskell programmer I expected to run into trouble once I started modifying code - but I didn't expect to have trouble with code from a book!


The function is no longer called rnf . It's called rdeepseq now. Just replace it. :)

You can find the contents of the parallel package online by googling "control parallel strategies hackage", or clicking here.

链接地址: http://www.djcxy.com/p/42944.html

上一篇: 哈斯克尔:monadic takeWhile?

下一篇: 真实世界的Haskell代码不能编译?