Skip to content

Commit 91535d6

Browse files
authored
Merge pull request #15 from phadej/prepare-0.2
Prepare-0.2
2 parents 4e13f4c + 363951a commit 91535d6

File tree

8 files changed

+92
-68
lines changed

8 files changed

+92
-68
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.11.20210101
11+
# version: 0.11.20210222
1212
#
13-
# REGENDATA ("0.11.20210101",["github","cabal.project"])
13+
# REGENDATA ("0.11.20210222",["github","cabal.project"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -22,15 +22,17 @@ on:
2222
- master
2323
jobs:
2424
linux:
25-
name: Haskell-CI Linux - GHC ${{ matrix.ghc }}
25+
name: Haskell-CI - Linux - GHC ${{ matrix.ghc }}
2626
runs-on: ubuntu-18.04
2727
container:
2828
image: buildpack-deps:bionic
2929
continue-on-error: ${{ matrix.allow-failure }}
3030
strategy:
3131
matrix:
3232
include:
33-
- ghc: 8.10.3
33+
- ghc: 9.0.1
34+
allow-failure: false
35+
- ghc: 8.10.4
3436
allow-failure: false
3537
- ghc: 8.8.4
3638
allow-failure: false
@@ -62,7 +64,7 @@ jobs:
6264
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common
6365
apt-add-repository -y 'ppa:hvr/ghc'
6466
apt-get update
65-
apt-get install -y ghc-$GHC_VERSION cabal-install-3.2
67+
apt-get install -y ghc-$GHC_VERSION cabal-install-3.4
6668
env:
6769
GHC_VERSION: ${{ matrix.ghc }}
6870
- name: Set PATH and environment variables
@@ -75,12 +77,13 @@ jobs:
7577
echo "HC=$HC" >> $GITHUB_ENV
7678
echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV
7779
echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV
78-
echo "CABAL=/opt/cabal/3.2/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
80+
echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
7981
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
8082
echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV
8183
if [ $((HCNUMVER >= 70400)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV ; else echo "ARG_TESTS=--disable-tests" >> $GITHUB_ENV ; fi
8284
if [ $((HCNUMVER >= 70400)) -ne 0 ] ; then echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV ; else echo "ARG_BENCH=--disable-benchmarks" >> $GITHUB_ENV ; fi
83-
echo "ARG_COMPILER=--ghc --with-compiler=/opt/ghc/$GHC_VERSION/bin/ghc" >> $GITHUB_ENV
85+
echo "HEADHACKAGE=false" >> $GITHUB_ENV
86+
echo "ARG_COMPILER=--ghc --with-compiler=$HC" >> $GITHUB_ENV
8487
echo "GHCJSARITH=0" >> $GITHUB_ENV
8588
env:
8689
GHC_VERSION: ${{ matrix.ghc }}
@@ -115,11 +118,6 @@ jobs:
115118
- name: update cabal index
116119
run: |
117120
$CABAL v2-update -v
118-
- name: cache (tools)
119-
uses: actions/cache@v2
120-
with:
121-
key: ${{ runner.os }}-${{ matrix.ghc }}-tools-c0007cad
122-
path: ~/.haskell-ci-tools
123121
- name: install cabal-plan
124122
run: |
125123
mkdir -p $HOME/.cabal/bin
@@ -129,18 +127,27 @@ jobs:
129127
rm -f cabal-plan.xz
130128
chmod a+x $HOME/.cabal/bin/cabal-plan
131129
cabal-plan --version
132-
- name: install doctest
130+
- name: install cabal-docspec
133131
run: |
134-
if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then $CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.17' ; fi
135-
if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then doctest --version ; fi
132+
mkdir -p $HOME/.cabal/bin
133+
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz > cabal-docspec.xz
134+
echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c -
135+
xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
136+
rm -f cabal-docspec.xz
137+
chmod a+x $HOME/.cabal/bin/cabal-docspec
138+
cabal-docspec --version
136139
- name: checkout
137140
uses: actions/checkout@v2
138141
with:
139142
path: source
143+
- name: initial cabal.project for sdist
144+
run: |
145+
touch cabal.project
146+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
147+
cat cabal.project
140148
- name: sdist
141149
run: |
142150
mkdir -p sdist
143-
cd source || false
144151
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
145152
- name: unpack
146153
run: |
@@ -184,10 +191,10 @@ jobs:
184191
- name: tests
185192
run: |
186193
if [ $((HCNUMVER >= 70400)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct ; fi
187-
- name: doctest
194+
- name: docspec
188195
run: |
189-
if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then cd ${PKGDIR_rere} || false ; fi
190-
if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then doctest src ; fi
196+
if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all ; fi
197+
if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then cabal-docspec $ARG_COMPILER ; fi
191198
- name: cabal check
192199
run: |
193200
cd ${PKGDIR_rere} || false

cabal.haskell-ci

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
branches: master
2-
tests: >=7.4
1+
branches: master
2+
tests: >=7.4
33
benchmarks: >=7.4
4-
doctest: >=8.4
4+
docspec: >=8.4
55

66
constraint-set no-cfg
7-
ghc: >=7.8
7+
ghc: >=7.8
88
constraints: rere -rere-cfg
99

1010
constraint-set intersection

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.2
2+
3+
- Change LaTeX generation output

rere.cabal

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cabal-version: 2.2
22
name: rere
3-
version: 0.1
4-
x-revision: 1
3+
version: 0.2
54
synopsis:
65
Regular-expressions extended with fixpoints for context-free powers
76

@@ -14,8 +13,11 @@ author: Oleg Grenrus <[email protected]>
1413
maintainer: Oleg Grenrus <[email protected]>
1514
license: BSD-3-Clause
1615
license-file: LICENSE
17-
extra-source-files: jsverify.json
18-
data-files: rere.sty
16+
extra-source-files:
17+
changelog.md
18+
jsverify.json
19+
rere.sty
20+
1921
tested-with:
2022
GHC ==7.0.4
2123
|| ==7.2.2
@@ -28,49 +30,50 @@ tested-with:
2830
|| ==8.4.4
2931
|| ==8.6.5
3032
|| ==8.8.4
31-
|| ==8.10.3
33+
|| ==8.10.4
34+
|| ==9.0.1
3235

3336
source-repository head
3437
type: git
3538
location: https://github.com/phadej/rere.git
3639

3740
flag rere-cfg
38-
description: CFG functionality, needs dependency on fin and vec
41+
description: CFG functionality, adds dependency on fin and vec
3942
default: True
4043
manual: True
4144

4245
flag rere-intersection
43-
description: Add add intersection constructor. EXPERIMENTAL
46+
description: Add intersection constructor. EXPERIMENTAL
4447
default: False
4548
manual: True
4649

4750
library
48-
default-language: Haskell2010
49-
hs-source-dirs: src
50-
ghc-options: -Wall
51+
default-language: Haskell2010
52+
hs-source-dirs: src
53+
ghc-options: -Wall
5154

52-
if impl(ghc >=8.10)
55+
if impl(ghc >=9)
5356
ghc-options: -Wmissing-safe-haskell-mode -Winferred-safe-imports
5457

55-
-- GHC boot library
58+
-- GHC boot libraries
5659
build-depends:
57-
, base >=4.3.0.0 && <4.15
60+
, base >=4.3.0.0 && <4.16
5861
, containers ^>=0.4.0.0 || ^>=0.5.0.0 || ^>=0.6.0.1
5962
, parsec ^>=3.1.12.0
6063
, transformers ^>=0.3.0.0 || ^>=0.4.2.0 || ^>=0.5.2.0
6164

6265
-- other dependencies
63-
build-depends: QuickCheck ^>=2.13.2 || ^>=2.14
66+
build-depends: QuickCheck ^>=2.14.2
6467

6568
-- compat
6669
if !impl(ghc >=7.10)
67-
build-depends: void ^>=0.7.2
70+
build-depends: void ^>=0.7.3
6871

6972
if !impl(ghc >=8.0)
70-
build-depends: semigroups >=0.18.4 && <0.20
73+
build-depends: semigroups >=0.18.5 && <0.20
7174

7275
-- expose examples first, so `cabal repl` loads them.
73-
exposed-modules: RERE.Examples
76+
exposed-modules: RERE.Examples
7477

7578
if (flag(rere-cfg) && impl(ghc >=7.8))
7679
exposed-modules: RERE.Examples.JSON
@@ -87,20 +90,23 @@ library
8790
RERE.Type
8891
RERE.Var
8992

90-
other-modules: RERE.Tuples
93+
other-modules: RERE.Tuples
9194

9295
if (flag(rere-cfg) && impl(ghc >=7.8))
9396
build-depends:
94-
, fin ^>=0.1.1
95-
, vec ^>=0.3
97+
, fin ^>=0.2
98+
, vec ^>=0.4
9699

97100
exposed-modules: RERE.CFG
101+
98102
else
99-
cpp-options: -DRERE_NO_CFG
103+
cpp-options: -DRERE_NO_CFG
100104

101105
if flag(rere-intersection)
102106
cpp-options: -DRERE_INTERSECTION
103107

108+
x-docspec-options: -XOverloadedStrings
109+
104110
benchmark simple
105111
type: exitcode-stdio-1.0
106112
default-language: Haskell2010
@@ -117,7 +123,7 @@ benchmark simple
117123
, rere
118124

119125
if !(flag(rere-cfg) && impl(ghc >=7.8))
120-
cpp-options: -DRERE_NO_CFG
126+
cpp-options: -DRERE_NO_CFG
121127

122128
if flag(rere-intersection)
123129
cpp-options: -DRERE_INTERSECTION
@@ -175,7 +181,7 @@ test-suite properties
175181
, QuickCheck
176182
, quickcheck-instances ^>=0.3.22
177183
, rere
178-
, tasty ^>=1.2.3 || ^>=1.3.1
184+
, tasty ^>=1.4.0.1
179185
, tasty-quickcheck ^>=0.10.1.1
180186

181187
if flag(rere-intersection)

src/RERE/CFG.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import Data.Traversable (Traversable (..))
2929

3030
-- $setup
3131
-- >>> :set -XOverloadedStrings
32+
-- >>> import Data.Fin (Fin (..))
33+
-- >>> import Data.Vec.Lazy (Vec (..))
34+
-- >>> import RERE
3235

3336
-- | Context-free grammar represented as @n@ equations
3437
-- of 'RE' ('CFGBase') with @n@ variables.

src/RERE/Examples.hs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import Data.Semigroup (Semigroup (..))
4343
-- >>> import Test.QuickCheck.Random (mkQCGen)
4444
-- >>> import Test.QuickCheck.Gen (unGen)
4545
-- >>> import Control.Monad.ST (runST)
46+
-- >>> import RERE
4647
-- >>> let runGen seed = maybe "<<null>>" (\g' -> unGen g' (mkQCGen seed) 10)
4748
-- >>> let showRef re = matchDebugR re ""
4849

@@ -92,11 +93,11 @@ syntaxExamples = do
9293
-- >>> matchR ex1 "ababa"
9394
-- False
9495
--
95-
-- >>> runGen 42 (generate 10 20 ex1)
96-
-- "ababab"
96+
-- >>> runGen 43 (generate 10 20 ex1)
97+
-- "abababababababababab"
9798
--
9899
-- >>> runGen 44 (generate 10 20 ex1)
99-
-- "abababababababababab"
100+
-- "ababab"
100101
--
101102
ex1 :: RE Void
102103
ex1 = star_ (ch_ 'a' <> ch_ 'b')
@@ -124,7 +125,7 @@ ex1run1 = putLatexTrace ex1 "abab"
124125
-- True
125126
--
126127
-- >>> runGen 42 (generate 10 20 ex2)
127-
-- "aaaaaaaaaaa"
128+
-- "aaaaaa"
128129
--
129130
-- >>> runGen 44 (generate 10 20 ex2)
130131
-- "aaaaaaaaaa"
@@ -158,11 +159,11 @@ ex2run1 = putLatexTrace ex2 "aaa"
158159
-- >>> matchR ex3 "ababa"
159160
-- False
160161
--
161-
-- >>> runGen 42 (generate 10 20 ex3)
162-
-- "ab"
162+
-- >>> runGen 43 (generate 10 20 ex3)
163+
-- "abababab"
163164
--
164-
-- >>> runGen 50 (generate 10 20 ex3)
165-
-- "ababab"
165+
-- >>> runGen 44 (generate 10 20 ex3)
166+
-- "abab"
166167
--
167168
ex3 :: RE Void
168169
ex3 = Fix "x" (Eps \/ ch_ 'a' <> ch_ 'b' <> Var B)
@@ -187,11 +188,11 @@ ex3run1 = putLatexTrace ex3 "abab"
187188
-- >>> matchR ex4 "aaaabbbb"
188189
-- True
189190
--
190-
-- >>> runGen 42 (generate 10 20 ex4)
191-
-- "aabb"
191+
-- >>> runGen 43 (generate 10 20 ex4)
192+
-- "ab"
192193
--
193-
-- >>> runGen 45 (generate 10 20 ex4)
194-
-- "aaabbb"
194+
-- >>> runGen 47 (generate 10 20 ex4)
195+
-- "aaaabbbb"
195196
--
196197
ex4 :: RE Void
197198
ex4 = Fix "x" (Eps \/ ch_ 'a' <> Var B <> ch_ 'b')
@@ -222,11 +223,11 @@ ex4run1 = putLatexTrace ex4 "aaaabbbb"
222223
-- >>> matchR ex5 "ababa"
223224
-- False
224225
--
225-
-- >>> runGen 42 (generate 10 20 ex5)
226+
-- >>> runGen 43 (generate 10 20 ex5)
226227
-- "ab"
227228
--
228-
-- >>> runGen 45 (generate 10 20 ex5)
229-
-- "ababab"
229+
-- >>> runGen 51 (generate 10 20 ex5)
230+
-- "abab"
230231
--
231232
ex5 :: RE Void
232233
ex5 = Fix "x" (Eps \/ Var B <> ch_ 'a' <> ch_ 'b')
@@ -255,8 +256,8 @@ ex5run1 = putLatexTrace ex5 "abab"
255256
-- >>> matchR ex6 "(1+2)*3"
256257
-- True
257258
--
258-
-- >>> runGen 42 (generate 5 5 ex6)
259-
-- "96+(09493+90790)*19"
259+
-- >>> runGen 43 (generate 5 5 ex6)
260+
-- "74501+(534*19450)*(99050)"
260261
--
261262
ex6 :: RE Void
262263
ex6 = let_ "d" (Ch "0123456789")
@@ -312,8 +313,8 @@ exCfgN = "digit" ::: "digits" ::: "term" ::: "mult" ::: "expr" ::: VNil
312313
-- >>> charClasses ex7
313314
-- fromList "\NUL()*+,0:"
314315
--
315-
-- >>> runGen 42 (generate 5 5 ex7)
316-
-- "(0181+912595*00+((1228)+467+(80)+(216406))*(65)+4+5*5149+994734)"
316+
-- >>> runGen 43 (generate 5 5 ex7)
317+
-- "(3431*((0337+5+070346+4))+76848+((4126+350875)*98769+308194+270+03118)+888*(95+90904)+(301069+7+715835)+2809)"
317318
--
318319
ex7 :: Ord a => RE a
319320
ex7 = cfgToRE exCfgN exCfg

src/RERE/Examples/JSON.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import qualified RERE.CharSet as CS
2424
import Data.Semigroup (Semigroup (..))
2525
#endif
2626

27+
-- $setup
28+
-- >>> import RERE
29+
2730
-- | Size of JSON grammar, 22.
2831
type Size = N.Mult2 (N.Plus N.Nat5 N.Nat6)
2932

0 commit comments

Comments
 (0)