Reputation: 1330
I'm following this guide and I got to the "Write your first parallel Haskell program", where you have you use Control.Parallel
. When i try to compile it, I get:
A.hs:1:1: error:
Could not find module `Control.Parallel'
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
1 | import Control.Parallel
| ^^^^^^^^^^^^^^^^^^^^^^^
Nowhere does it say that I have to install anything. Despite that, I ran cabal install --lib parallel
and it installed okay but It still cannot find the package. When I run ghc-pkg list
parallel
is not on the list.
How do I go about solving that?
Upvotes: 4
Views: 1532
Reputation: 4053
Do not use cabal install or stack install to manage your dependencies.
Instead use cabal or stack files to list all of those packages, then use "build" commands to fetch them into your project folder.
Both cabal and stack will then supply proper flags to your dependencies when compiling with GHC.
Alternatively, find out where did cabal downloaded that source code and pass it with flags to GHC. Thought that's unnecessary low level work.
Upvotes: 3
Reputation: 331
You can do either of two things here:
parallel
as a dependency. To do so, I'll refer you to Cabal's quickstart guide.parallel
package. In the example you listed, you need to import Control.Parallel
to make use of par
and pseq
. However, these functions are also part of GHC.Conc
, which is part of the base
package. So, to get your program to work without any package management involved, simply replace import Control.Parallel
by import GHC.Conc
, and you should be good.Upvotes: 6