7

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 exportparZipWith'. On compiling LineChunks.hs I get: Module Control.Parallel.Strategies' does not exportrnf'.

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!

Velvet Ghost
  • 408
  • 1
  • 8
  • 26

1 Answers1

10

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.

Clark Gaebel
  • 15,590
  • 16
  • 61
  • 89
  • That worked! Thanks a lot! That was the first Haskell code I've ever compiled and it couldn't be a worse start. :P – Velvet Ghost Mar 01 '13 at 00:36
  • 1
    No problem! Haskell can be a lot of fun. Keep it up! – Clark Gaebel Mar 01 '13 at 00:38
  • 1
    Is there a RWH errata page somewhere? The mtl 1.x -> 2.0 transition threw me off the tracks, for some time. – yatima2975 Mar 01 '13 at 01:52
  • 2
    @yatima2975 Not any official errata, but there's this SO question and its corresponding answer: http://stackoverflow.com/q/23727768/126014 I've found it helpful from time to time. – Mark Seemann Apr 19 '16 at 09:31