Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real World Haskell code not compiling?

Tags:

haskell

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!

like image 212
Velvet Ghost Avatar asked Mar 01 '13 00:03

Velvet Ghost


1 Answers

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.

like image 170
Clark Gaebel Avatar answered Oct 12 '22 22:10

Clark Gaebel