Update: I just found this documentation page. Wish there was a link to it from the documentation that I'd been using, which seemed to be the definitive API doc. But maybe it's a new, unreleased work.
Update 2: This documentation has given me a lot better idea how to use the Control.Parallel.Strategies module. However I haven't quite solved the problem... see end of question.
I've been trying to use parListChunk or some other parallel control features in Haskell. But I can't figure out how to use them. Warning: I'm a Haskell noob. I learned some things about functional programming with Scheme about 20 years ago (!).
Here's my non-parallelized function:
possibKs n r = [ (k, (hanoiRCountK n k r)) | k <- [1 .. n-1] ]
I want to parallelize it, something like this naive attempt:
possibKs n r
| n < parCutoff = results
| otherwise = parListChunk parChunkSize results
where results = [ (k, (hanoiRCountK n k r)) | k <- [1 .. n-1] ]
But that structure isn't right for parListChunk. The docs say:
parListChunk :: Int -> Strategy a -> Strategy [a]
parListChunk sequentially applies a strategy to chunks (sub-sequences) of a list in parallel. Useful to increase grain size
Good, that's what I want. But how to use it? I haven't been able to find any examples of this. If I'm understanding the type declaration, parListChunk is a function that takes an Int a