-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added flake file * using modular arithmetic package and tests pass * temp disable tests * remove tests * problem with rules * Empty-Commit * remove nix files * builds with 9.8 9.6 * ormolu * add tests * changelog and bump package version
- Loading branch information
Showing
26 changed files
with
776 additions
and
841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,71 @@ | ||
name: Cabal CI | ||
|
||
name: build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
# INFO: The following configuration block ensures that only one build runs per branch, | ||
# which may be desirable for projects with a costly build process. | ||
# Remove this block from the CI workflow to let each CI job run to completion. | ||
concurrency: | ||
group: build-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: cabal-${{ matrix.cabal}} ${{ matrix.ghc }} ${{ matrix.os }} | ||
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest] | ||
ghc: ["8.10.1", "8.8.1", "8.6.5", "8.6.4", "8.6.3", "8.6.2"] | ||
cabal: ["3.0", "3.2"] | ||
os: [ubuntu-latest] | ||
ghc-version: ['9.8', '9.6'] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-haskell@v1 | ||
name: Setup Haskell | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: ${{ matrix.cabal }} | ||
|
||
- uses: actions/cache@v1 | ||
name: Cache ~/.cabal/packages | ||
with: | ||
path: ~/.cabal/packages | ||
key: cabal-packages-${{ matrix.ghc }} | ||
|
||
- uses: actions/cache@v1 | ||
name: Cache ~/.cabal/store | ||
with: | ||
path: ~/.cabal/store | ||
key: cabal-store-${{ matrix.ghc }} | ||
|
||
- uses: actions/cache@v1 | ||
name: Cache dist-newstyle | ||
with: | ||
path: dist-newstyle | ||
key: dist-newstyle-${{ matrix.ghc }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
cabal update | ||
- name: Build | ||
run: | | ||
cabal new-install tasty-discover | ||
cabal new-build | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up GHC ${{ matrix.ghc-version }} | ||
uses: haskell-actions/setup@v2 | ||
id: setup | ||
with: | ||
ghc-version: ${{ matrix.ghc-version }} | ||
# Defaults, added for clarity: | ||
cabal-version: 'latest' | ||
cabal-update: true | ||
|
||
- name: Configure the build | ||
run: | | ||
cabal configure --enable-tests --enable-benchmarks --disable-documentation | ||
cabal build all --dry-run | ||
# The last step generates dist-newstyle/cache/plan.json for the cache key. | ||
|
||
- name: Restore cached dependencies | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
env: | ||
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | ||
with: | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | ||
restore-keys: ${{ env.key }}- | ||
|
||
- name: Install dependencies | ||
# If we had an exact cache hit, the dependencies will be up to date. | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: cabal build all --only-dependencies | ||
|
||
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. | ||
- name: Save cached dependencies | ||
uses: actions/cache/save@v3 | ||
# If we had an exact cache hit, trying to save the cache would error because of key clash. | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
|
||
- name: Build | ||
run: cabal build all | ||
|
||
- name: Test | ||
run: cabal test all |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
module Bench.Galois where | ||
|
||
import Protolude | ||
|
||
import Criterion.Main | ||
import Data.Field.Galois hiding (recip, (/)) | ||
import Data.Field.Galois | ||
import GHC.Base | ||
import Protolude | ||
|
||
benchmark :: GaloisField k => String -> k -> k -> Benchmark | ||
benchmark s a b = bgroup s | ||
[ bench "Addition" $ | ||
nf (uncurry (+)) (a, b) | ||
, bench "Multiplication" $ | ||
nf (uncurry (*)) (a, b) | ||
, bench "Negation" $ | ||
nf negate a | ||
, bench "Subtraction" $ | ||
nf (uncurry (-)) (a, b) | ||
, bench "Inversion" $ | ||
nf recip a | ||
, bench "Division" $ | ||
nf (uncurry (/)) (a, b) | ||
, bench "Frobenius endomorphism" $ | ||
nf frob a | ||
, bench "Square root" $ | ||
nf sr a | ||
] | ||
benchmark :: (GaloisField k) => String -> k -> k -> Benchmark | ||
benchmark s a b = | ||
bgroup | ||
s | ||
[ bench "Addition" $ | ||
nf (uncurry (+)) (a, b), | ||
bench "Multiplication" $ | ||
nf (uncurry (*)) (a, b), | ||
bench "Negation" $ | ||
nf negate a, | ||
bench "Subtraction" $ | ||
nf (uncurry (-)) (a, b), | ||
bench "Inversion" $ | ||
nf recip a, | ||
bench "Division" $ | ||
nf (uncurry (/)) (a, b), | ||
bench "Frobenius endomorphism" $ | ||
nf frob a, | ||
bench "Square root" $ | ||
nf sr a | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
module Main where | ||
|
||
import Protolude | ||
|
||
import Criterion.Main | ||
|
||
import Bench.Binary | ||
import Bench.Extension | ||
import Bench.Prime | ||
import Criterion.Main | ||
import Protolude | ||
|
||
main :: IO () | ||
main = defaultMain | ||
[benchBinary, benchExtension, benchPrime] | ||
main = | ||
defaultMain | ||
[benchBinary, benchExtension, benchPrime] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests: True | ||
benchmarks: True | ||
|
||
packages: . | ||
|
||
source-repository-package | ||
type: git | ||
location: https://github.com/chessai/semirings.git | ||
tag: 2631c542b57abc9bc9e92db273ab8e80ae88048c | ||
--sha256: j/zGFd2aeowzJfgCCBmJYmG8mDsfF0irqj/cPOw9ulE= |
Oops, something went wrong.