Skip to content

Commit 06ac928

Browse files
committed
problem with rules
1 parent b828180 commit 06ac928

File tree

11 files changed

+167
-282
lines changed

11 files changed

+167
-282
lines changed

Diff for: .github/workflows/cabal.yml

+58-41
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,68 @@
1-
name: Cabal CI
2-
1+
name: build
32
on:
43
push:
5-
branches:
6-
- master
4+
branches: [main, master]
75
pull_request:
6+
branches: [main, master]
7+
8+
# INFO: The following configuration block ensures that only one build runs per branch,
9+
# which may be desirable for projects with a costly build process.
10+
# Remove this block from the CI workflow to let each CI job run to completion.
11+
concurrency:
12+
group: build-${{ github.ref }}
13+
cancel-in-progress: true
814

915
jobs:
1016
build:
11-
name: cabal-${{ matrix.cabal}} ${{ matrix.ghc }} ${{ matrix.os }}
17+
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
1219
strategy:
20+
fail-fast: false
1321
matrix:
14-
os: [ubuntu-latest, macOS-latest]
15-
ghc: ["8.10.1", "8.8.1", "8.6.5", "8.6.4", "8.6.3", "8.6.2"]
16-
cabal: ["3.0", "3.2"]
22+
os: [ubuntu-latest]
23+
ghc-version: ['9.8', '9.6', '9.4']
1724

18-
runs-on: ${{ matrix.os }}
1925
steps:
20-
- uses: actions/checkout@v1
21-
- uses: actions/setup-haskell@v1
22-
name: Setup Haskell
23-
with:
24-
ghc-version: ${{ matrix.ghc }}
25-
cabal-version: ${{ matrix.cabal }}
26-
27-
- uses: actions/cache@v1
28-
name: Cache ~/.cabal/packages
29-
with:
30-
path: ~/.cabal/packages
31-
key: cabal-packages-${{ matrix.ghc }}
32-
33-
- uses: actions/cache@v1
34-
name: Cache ~/.cabal/store
35-
with:
36-
path: ~/.cabal/store
37-
key: cabal-store-${{ matrix.ghc }}
38-
39-
- uses: actions/cache@v1
40-
name: Cache dist-newstyle
41-
with:
42-
path: dist-newstyle
43-
key: dist-newstyle-${{ matrix.ghc }}
44-
45-
- name: Install dependencies
46-
run: |
47-
cabal update
48-
- name: Build
49-
run: |
50-
cabal new-install tasty-discover
51-
cabal new-build
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up GHC ${{ matrix.ghc-version }}
29+
uses: haskell-actions/setup@v2
30+
id: setup
31+
with:
32+
ghc-version: ${{ matrix.ghc-version }}
33+
# Defaults, added for clarity:
34+
cabal-version: 'latest'
35+
cabal-update: true
36+
37+
- name: Configure the build
38+
run: |
39+
cabal configure --enable-tests --enable-benchmarks --disable-documentation
40+
cabal build all --dry-run
41+
# The last step generates dist-newstyle/cache/plan.json for the cache key.
42+
43+
- name: Restore cached dependencies
44+
uses: actions/cache/restore@v3
45+
id: cache
46+
env:
47+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
48+
with:
49+
path: ${{ steps.setup.outputs.cabal-store }}
50+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
51+
restore-keys: ${{ env.key }}-
52+
53+
- name: Install dependencies
54+
# If we had an exact cache hit, the dependencies will be up to date.
55+
if: steps.cache.outputs.cache-hit != 'true'
56+
run: cabal build all --only-dependencies
57+
58+
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
59+
- name: Save cached dependencies
60+
uses: actions/cache/save@v3
61+
# If we had an exact cache hit, trying to save the cache would error because of key clash.
62+
if: steps.cache.outputs.cache-hit != 'true'
63+
with:
64+
path: ${{ steps.setup.outputs.cabal-store }}
65+
key: ${{ steps.cache.outputs.cache-primary-key }}
66+
67+
- name: Build
68+
run: cabal build all

Diff for: .github/workflows/stack.yml

-60
This file was deleted.

Diff for: README.md

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
</a>
55
</p>
66

7-
![Stack CI](https://github.com/adjoint-io/galois-field/workflows/Stack%20CI/badge.svg)
87
![Cabal CI](https://github.com/adjoint-io/galois-field/workflows/Cabal%20CI/badge.svg)
98
[![Hackage](https://img.shields.io/hackage/v/galois-field.svg)](https://hackage.haskell.org/package/galois-field)
109

Diff for: cabal.project

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
packages:
2-
./galois-field.cabal
1+
tests: True
2+
3+
packages:
4+
.
5+
6+
repository hackage.haskell.org
7+
url: http://hackage.haskell.org/
8+
9+
source-repository-package
10+
type: git
11+
location: https://github.com/chessai/semirings.git
12+
tag: 2631c542b57abc9bc9e92db273ab8e80ae88048c
13+
--sha256: j/zGFd2aeowzJfgCCBmJYmG8mDsfF0irqj/cPOw9ulE=

Diff for: galois-field.cabal

+67-38
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,40 @@ license: MIT
1313
license-file: LICENSE
1414
build-type: Simple
1515
extra-source-files:
16-
README.notex.md
1716
ChangeLog.md
17+
README.notex.md
1818

19-
source-repository head
20-
type: git
21-
location: https://github.com/adjoint-io/galois-field
19+
common warnings
20+
ghc-options: -Wall -Wredundant-constraints -Werror
21+
22+
common deps
23+
build-depends:
24+
, base >=4.18
25+
, bitvec
26+
, groups
27+
, integer-gmp
28+
, mod
29+
, MonadRandom
30+
, poly
31+
, protolude
32+
, QuickCheck
33+
, semirings
34+
, vector
35+
, wl-pprint-text
36+
37+
common extensions
38+
default-extensions:
39+
NoImplicitPrelude
40+
DataKinds
41+
OverloadedLists
42+
OverloadedStrings
43+
PatternSynonyms
44+
TypeFamilies
45+
TypeOperators
2246

2347
library
24-
exposed-modules: Data.Field.Galois
48+
import: warnings, extensions, deps
49+
exposed-modules: Data.Field.Galois
2550
other-modules:
2651
Data.Field.Galois.Base
2752
Data.Field.Galois.Binary
@@ -32,39 +57,43 @@ library
3257
Data.Field.Galois.Tower
3358
Data.Field.Galois.Unity
3459

35-
hs-source-dirs: src
36-
default-extensions:
37-
NoImplicitPrelude
38-
DataKinds
39-
DeriveFunctor
40-
DeriveGeneric
41-
FlexibleContexts
42-
FlexibleInstances
43-
GeneralizedNewtypeDeriving
44-
KindSignatures
45-
LambdaCase
46-
MultiParamTypeClasses
47-
OverloadedLists
48-
OverloadedStrings
49-
PatternSynonyms
50-
RankNTypes
51-
RecordWildCards
52-
ScopedTypeVariables
53-
TypeFamilies
60+
hs-source-dirs: src
61+
ghc-options: -freverse-errors -O2
62+
default-language: GHC2021
63+
64+
test-suite galois-field-tests
65+
import: warnings, extensions, deps
66+
type: exitcode-stdio-1.0
67+
main-is: Main.hs
68+
other-modules:
69+
Test.Binary
70+
Test.Extension
71+
Test.Galois
72+
Test.Prime
73+
74+
hs-source-dirs: test
75+
ghc-options: -freverse-errors -O2
76+
build-depends:
77+
, galois-field
78+
, tasty
79+
, tasty-quickcheck
80+
81+
default-language: GHC2021
82+
83+
benchmark galois-field-benchmarks
84+
import: warnings, extensions, deps
85+
type: exitcode-stdio-1.0
86+
main-is: Main.hs
87+
other-modules:
88+
Bench.Binary
89+
Bench.Extension
90+
Bench.Galois
91+
Bench.Prime
5492

55-
ghc-options: -freverse-errors -O2 -Wall
93+
hs-source-dirs: bench
94+
ghc-options: -freverse-errors -O2
5695
build-depends:
57-
, base >=4.10 && <5
58-
, bitvec ^>=1.1.3
59-
, groups >=0.4.1 && <0.6
60-
, integer-gmp ^>=1.1
61-
, modular-arithmetic ^>=2.0.0.1
62-
, MonadRandom ^>=0.5.1
63-
, poly >=0.3.2 && <0.6
64-
, protolude ^>=0.3.3
65-
, QuickCheck >=2.13 && <2.15
66-
, semirings ^>=0.6
67-
, vector ^>=0.12.0
68-
, wl-pprint-text ^>=1.2.0
96+
, criterion
97+
, galois-field
6998

70-
default-language: Haskell2010
99+
default-language: GHC2021

Diff for: src/Data/Field/Galois/Binary.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ toB = fromInteger
208208
{-# INLINABLE toB #-}
209209

210210
-- | Unsafe convert from @Z@ to @GF(2^q)[X]/\<f(X)\>@.
211-
toB' :: KnownNat p => Integer -> Binary p
211+
toB' :: Integer -> Binary p
212212
toB' = B . toPoly
213213
{-# INLINABLE toB' #-}
214214

Diff for: src/Data/Field/Galois/Extension.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class GaloisField k => IrreducibleMonic p k where
4646
class GaloisField k => ExtensionField k where
4747
{-# MINIMAL fromE #-}
4848
-- | Convert from @GF(p^q)[X]/\<f(X)\>@ to @GF(p^q)[X]@.
49-
fromE :: (GaloisField l, IrreducibleMonic p l, k ~ Extension p l) => k -> [l]
49+
fromE :: (IrreducibleMonic p l, k ~ Extension p l) => k -> [l]
5050

5151
-- | Extension field elements.
5252
newtype Extension p k = E (VPoly k)

0 commit comments

Comments
 (0)