Skip to content

Commit 58af4f0

Browse files
konsumlammBodigrim
andauthored
Improve documentation (#74)
* Improve documentation of `Control.Parallel` * Update changelog * Update CI * Fix typo Co-authored-by: ˌbodʲɪˈɡrʲim <[email protected]>
1 parent 4fb0cc2 commit 58af4f0

File tree

4 files changed

+62
-47
lines changed

4 files changed

+62
-47
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/andreasabel/haskell-ci
1010
#
11-
# version: 0.19.20241021
11+
# version: 0.19.20241219
1212
#
13-
# REGENDATA ("0.19.20241021",["github","parallel.cabal"])
13+
# REGENDATA ("0.19.20241219",["github","parallel.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -32,19 +32,19 @@ jobs:
3232
strategy:
3333
matrix:
3434
include:
35-
- compiler: ghc-9.12.20241014
35+
- compiler: ghc-9.12.1
3636
compilerKind: ghc
37-
compilerVersion: 9.12.20241014
37+
compilerVersion: 9.12.1
3838
setup-method: ghcup
3939
allow-failure: false
4040
- compiler: ghc-9.10.1
4141
compilerKind: ghc
4242
compilerVersion: 9.10.1
4343
setup-method: ghcup
4444
allow-failure: false
45-
- compiler: ghc-9.8.2
45+
- compiler: ghc-9.8.4
4646
compilerKind: ghc
47-
compilerVersion: 9.8.2
47+
compilerVersion: 9.8.4
4848
setup-method: ghcup
4949
allow-failure: false
5050
- compiler: ghc-9.6.6
@@ -99,16 +99,30 @@ jobs:
9999
allow-failure: false
100100
fail-fast: false
101101
steps:
102-
- name: apt
102+
- name: apt-get install
103103
run: |
104104
apt-get update
105105
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
106+
- name: Install GHCup
107+
run: |
106108
mkdir -p "$HOME/.ghcup/bin"
107109
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup"
108110
chmod a+x "$HOME/.ghcup/bin/ghcup"
111+
- name: Install cabal-install (prerelease)
112+
run: |
109113
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;
114+
"$HOME/.ghcup/bin/ghcup" install cabal 3.15.0.0.2024.10.3 || (cat "$HOME"/.ghcup/logs/*.* && false)
115+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.15.0.0.2024.10.3 -vnormal+nowrap" >> "$GITHUB_ENV"
116+
- name: Install GHC (GHCup)
117+
if: matrix.setup-method == 'ghcup'
118+
run: |
110119
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
111-
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
120+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
121+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
122+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
123+
echo "HC=$HC" >> "$GITHUB_ENV"
124+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
125+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
112126
env:
113127
HCKIND: ${{ matrix.compilerKind }}
114128
HCNAME: ${{ matrix.compiler }}
@@ -119,21 +133,12 @@ jobs:
119133
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
120134
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
121135
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
122-
HCDIR=/opt/$HCKIND/$HCVER
123-
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
124-
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
125-
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
126-
echo "HC=$HC" >> "$GITHUB_ENV"
127-
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
128-
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
129-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
130136
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
131137
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
132138
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
133139
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
134140
if [ $((HCNUMVER >= 91200)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
135141
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
136-
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
137142
env:
138143
HCKIND: ${{ matrix.compilerKind }}
139144
HCNAME: ${{ matrix.compiler }}
@@ -261,8 +266,8 @@ jobs:
261266
rm -f cabal.project.local
262267
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
263268
- name: save cache
264-
uses: actions/cache/save@v4
265269
if: always()
270+
uses: actions/cache/save@v4
266271
with:
267272
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
268273
path: ~/.cabal/store

Control/Parallel.hs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module Control.Parallel (
2727
) where
2828

2929
#ifdef __GLASGOW_HASKELL__
30-
import qualified GHC.Conc ( par, pseq )
30+
import qualified GHC.Conc (par, pseq)
3131

3232
infixr 0 `par`, `pseq`
3333
#endif
@@ -38,7 +38,8 @@ infixr 0 `par`, `pseq`
3838
-- argument in parallel with the second. Returns the value of the
3939
-- second argument.
4040
--
41-
-- @a ``par`` b@ is exactly equivalent semantically to @b@.
41+
-- The result of @a ``par`` b@ is always @b@, regardless of whether
42+
-- @a@ evaluates to a bottom, so for example @par undefined x = x@.
4243
--
4344
-- @par@ is generally used when the value of @a@ is likely to be
4445
-- required later, but not immediately. Also it is a good idea to
@@ -47,9 +48,8 @@ infixr 0 `par`, `pseq`
4748
-- running it in parallel.
4849
--
4950
-- Note that actual parallelism is only supported by certain
50-
-- implementations (GHC with the @-threaded@ option, and GPH, for
51-
-- now). On other implementations, @par a b = b@.
52-
--
51+
-- implementations (GHC with the @-threaded@ option, for now).
52+
-- On other implementations, @par a b = b@.
5353
par :: a -> b -> b
5454
#ifdef __GLASGOW_HASKELL__
5555
par = GHC.Conc.par
@@ -58,8 +58,13 @@ par = GHC.Conc.par
5858
par a b = b
5959
#endif
6060

61-
-- | Semantically identical to 'seq', but with a subtle operational
62-
-- difference: 'seq' is strict in both its arguments, so the compiler
61+
-- | Like 'seq' but ensures that the first argument is evaluated before returning.
62+
--
63+
-- @a ``pseq`` b@ evaluates @a@ to weak head normal form (WHNF)
64+
-- before returning @b@.
65+
--
66+
-- This is similar to 'seq', but with a subtle difference:
67+
-- 'seq' is strict in both its arguments, so the compiler
6368
-- may, for example, rearrange @a ``seq`` b@ into @b ``seq`` a ``seq`` b@.
6469
-- This is normally no problem when using 'seq' to express strictness,
6570
-- but it can be a problem when annotating code for parallelism,
@@ -71,7 +76,6 @@ par a b = b
7176
-- strict in its first argument (as far as the compiler is concerned),
7277
-- which restricts the transformations that the compiler can do, and
7378
-- ensures that the user can retain control of the evaluation order.
74-
--
7579
pseq :: a -> b -> b
7680
#ifdef __GLASGOW_HASKELL__
7781
pseq = GHC.Conc.pseq

changelog.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
# Changelog for [`parallel` package](http://hackage.haskell.org/package/parallel)
22

3+
## 3.3.0.0 *upcoming*
4+
5+
* Bump dependency bounds
6+
* Make strategic function application operators handle strategies correctly ([#61](https://github.com/haskell/parallel/pull/61))
7+
* Add `parFmap` ([#53](https://github.com/haskell/parallel/pull/53))
8+
39
## 3.2.2.0 *Jul 2018*
410

5-
- bump dependency bounds
6-
- add parEval
7-
- add a MonadFix instance
11+
* Bump dependency bounds
12+
* Add `parEval`
13+
* Add a `MonadFix Eval` instance
814

915
## 3.2.1.1 *Apr 2017*
1016

11-
- Compatibility with `deepseq-1.4.3`
12-
- Minor documentation clarifications
17+
* Compatibility with `deepseq-1.4.3`
18+
* Minor documentation clarifications
1319

1420
## 3.2.1.0 *Jan 2016*
1521

16-
- Support `base-4.9.0.0`
17-
- Add `{-# NOINLINE[1] rseq #-}` to make the `RULE` more robust
18-
- Fix broken links to papers in Haddock
19-
- Make `rpar` type signature consistent with `rseq` via type-synonym
20-
- Drop redundant `Ix`-constraint on `seqArray`/`seqArrayBounds` for GHC >= 8.0
22+
* Support `base-4.9.0.0`
23+
* Add `{-# NOINLINE[1] rseq #-}` to make the `RULE` more robust
24+
* Fix broken links to papers in Haddock
25+
* Make `rpar` type signature consistent with `rseq` via type synonym
26+
* Drop redundant `Ix`-constraint on `seqArray`/`seqArrayBounds` for GHC >= 8.0
2127

2228
## 3.2.0.6 *Dec 2014*
2329

24-
- Make `-Wall` message free for all supported `base` versions
30+
* Make `-Wall` message free for all supported `base` versions
2531

2632
## 3.2.0.5 *Dec 2014*
2733

28-
- Support `base-4.8.0.0`/`deepseq-1.4.0.0` (and thus GHC 7.10)
34+
* Support `base-4.8.0.0`/`deepseq-1.4.0.0` (and thus GHC 7.10)
2935

3036
## 3.2.0.4 *Nov 2013*
3137

32-
* Update package description to Cabal 1.10 format
33-
* Add support for GHC 7.8
34-
* Drop support for GHCs older than GHC 7.0.1
35-
* Add NOINLINE pragmas to `parBuffer`, `parList`, and `evalBuffer`
36-
to make RULEs more likely to fire
38+
* Update package description to Cabal 1.10 format
39+
* Add support for GHC 7.8
40+
* Drop support for GHCs older than GHC 7.0.1
41+
* Add NOINLINE pragmas to `parBuffer`, `parList`, and `evalBuffer`
42+
to make RULEs more likely to fire
3743

3844
## Older versions
3945

40-
* This package has a long history which is described in the Haddock documentation
41-
in the ["API History" section](./docs/Control-Parallel-Strategies.html#history)
46+
* This package has a long history which is described in the Haddock documentation
47+
in the ["API History" section](./docs/Control-Parallel-Strategies.html#history)

parallel.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ category: Control, Parallelism
1212
build-type: Simple
1313

1414
tested-with:
15-
GHC == 9.12.0
15+
GHC == 9.12.1
1616
GHC == 9.10.1
17-
GHC == 9.8.2
17+
GHC == 9.8.4
1818
GHC == 9.6.6
1919
GHC == 9.4.8
2020
GHC == 9.2.8

0 commit comments

Comments
 (0)