The compiler is complaining each time on different example applications of parallel Haskell; with this message:
Could not find module `Control.Parallel.Strategies'
The ghc compiler command:
ghc -threaded -i/sudo/dir/par-modules/3 -cpp -DEVAL_STRATEGIES -eventlog --make parFib.hs
Same with simpler
ghc -O2 --make -threaded parFib.hs
What detail am I overlooking? Am I missing some PATH variable.
Imports can look like this:
module Main where
import System
# if defined(EVAL_STRATEGIES)
import Control.Parallel
import Control.Parallel.Strategies
#endif
Cheers
You must install the parallel package from Hackage. In most sane setups, this should be as simple as typing
at your command prompt.
I'm adding a new answer (instead of a comment) for visibility reasons.
After trying Daniel's answer, I still wasn't able to do
import Control.Parallel
, neither fromghci
, nor with the compiler. The install command returned a warning message like this:What ultimately resolved the issue was:
Like Daniel said, you'll need the parallel package. However if you'd prefer to use your system's package manager (which some people think you should), you can.
Note that, at least in the Fedora repos, you'll need ghc-parallel-devel, not just ghc-parallel to build.