[GHC] #10958: "Annotating pure code for parallelism" docs based on old par/pseq primitives
GHC
ghc-devs at haskell.org
Sun Oct 11 12:05:15 UTC 2015
#10958: "Annotating pure code for parallelism" docs based on old par/pseq
primitives
-------------------------------------+-------------------------------------
Reporter: robstewartuk | Owner:
Type: bug | Status: new
Priority: lowest | Milestone:
Component: Documentation | Version: 7.10.2
Keywords: parallelim | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The example code in GHC 7.10.2 docs "7.28. Concurrent and Parallel
Haskell", then in "7.15.4. Annotating pure code for parallelism" the
recommendation is to use `par` and `pseq`. These primitives pre-dates the
strategy combinators `rpar` and `rseq`. The example given is:
{{{#!hs
import Control.Parallel
nfib :: Int -> Int
nfib n | n <= 1 = 1
| otherwise = par n1 (seq n2 (n1 + n2 + 1))
where n1 = nfib (n-1)
n2 = nfib (n-2)
}}}
The paper "Seq no more: Better Strategies for Parallel Haskell"
([http://www.macs.hw.ac.uk/~hwloidl/publications/strategies10.pdf])
advocates `Eval` as an "evaluation order" monad, as preferable (versus
`par` and `seq`) for loose control of evaluation order of parallelism.
Moreover, Simon Marlow's "Parallel and Concurrent Programming in Haskell"
doesn't mention the `par` and `seq` primitives at all.
Should the GHC docs for "Concurrent and Parallel Haskell" encourage the
use Eval combinators, either in addition to or instead of the `par` and
`seq` primitives? I'd be happy to contribute an update to the docs if
people agree to a shift in emphasis towards the Eval monad in the docs.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10958>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list