Skip to content

Commit

Permalink
Bump cabal version
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyRaga committed Aug 4, 2024
1 parent 70cf7cc commit aee7c76
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 55 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type nix-shell >/dev/null 2>&1 && use nix
10 changes: 6 additions & 4 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ["9.2.2", "9.0.2", "8.10.7", "8.8.4", "8.6.5"]
ghc: ["9.10.1", "9.8.2", "9.6.6"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v2

- uses: haskell/actions/setup@v1
- uses: haskell-actions/setup@v2.7.5
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 3.6.2.0
cabal-version: 3.12.1.0

- name: Set some window specific things
if: matrix.os == 'windows-latest'
run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV

- name: Configure project
run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
run: |
cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
cabal build all --enable-tests --dry-run
- name: Cabal cache over S3
uses: action-works/cabal-cache-s3@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ stack.yaml.lock
*~
/.ghc.environment.*

.direnv/
9 changes: 4 additions & 5 deletions avro.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 2.4

name: avro
version: 0.6.1.2
version: 0.6.2.0
synopsis: Avro serialization support for Haskell
description: Avro serialization and deserialization support for Haskell
category: Data
Expand Down Expand Up @@ -75,7 +75,7 @@ common raw-strings-qq { build-depends: raw-strings-qq
common scientific { build-depends: scientific }
common semigroups { build-depends: semigroups }
common tagged { build-depends: tagged }
common text { build-depends: text >= 1.2.3 && < 1.3 || >= 2.0 && < 2.1 }
common text { build-depends: text >= 1.2.3 && < 1.3 || >= 2.0 && < 2.2 }
common time { build-depends: time }
common template-haskell { build-depends: template-haskell >= 2.4 && < 3 }
common tf-random { build-depends: tf-random }
Expand All @@ -86,7 +86,7 @@ common uuid { build-depends: uuid
common vector { build-depends: vector }
common zlib { build-depends: zlib }

common gauge { if arch(x86_64) || arch(i386) { build-depends: gauge } }
common gauge { build-depends: criterion }

common config
default-language: Haskell2010
Expand Down Expand Up @@ -267,8 +267,7 @@ benchmark bench-time
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Main.hs
if arch(x86_64) || arch(i386)
other-modules: Bench.Deconflict
other-modules: Bench.Deconflict
Bench.Deconflict.Reader
Bench.Deconflict.Writer
Bench.Encoding
Expand Down
9 changes: 5 additions & 4 deletions bench/Bench/Deconflict.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Bench.Deconflict
)
where

import Data.Avro (decodeContainerWithReaderSchema, decodeValue, decodeValueWithSchema, encodeContainerWithSchema, encodeValueWithSchema, nullCodec)
import Data.Avro (decodeContainerWithReaderSchema, decodeValueWithSchema, encodeContainerWithSchema, encodeValueWithSchema, nullCodec)
import Data.Avro.Schema.ReadSchema (fromSchema)
import Data.Vector (Vector)

Expand All @@ -17,7 +17,8 @@ import qualified Bench.Deconflict.Writer as W
import qualified Data.Vector as Vector
import qualified System.Random as Random

import Gauge
-- import Gauge
import Criterion.Main

newOuter :: IO W.Outer
newOuter = do
Expand All @@ -29,12 +30,12 @@ many :: Int -> IO a -> IO (Vector a)
many = Vector.replicateM

values :: Benchmark
values = env (many 1e5 $ encodeValueWithSchema W.schema'Outer <$> newOuter) $ \ values ->
values = env (many 1e5 $ encodeValueWithSchema W.schema'Outer <$> newOuter) $ \ vs ->
let
readSchema = fromSchema W.schema'Outer
in bgroup "Encoded: ByteString"
[ bgroup "No Deconflict"
[ bench "Read via FromAvro" $ nf (fmap (decodeValueWithSchema @W.Outer readSchema)) values
[ bench "Read via FromAvro" $ nf (fmap (decodeValueWithSchema @W.Outer readSchema)) vs
]
]

Expand Down
7 changes: 3 additions & 4 deletions bench/Bench/Encoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ module Bench.Encoding
where

import Control.DeepSeq
import Data.Avro (decodeContainerWithEmbeddedSchema, encodeContainer, encodeContainerWithSchema, encodeValueWithSchema, nullCodec)
import Data.Avro (decodeContainerWithEmbeddedSchema, encodeValueWithSchema, nullCodec)
import qualified Data.Avro as Avro
import Data.Avro.Deriving (deriveAvroFromByteString, r)
import Data.ByteString (ByteString)
import Data.ByteString.Builder
import qualified Data.ByteString.Lazy as BL
import Data.List (unfoldr)
import qualified Data.Vector as Vector
import qualified System.Random as Random

import Gauge
-- import Gauge
import Criterion.Main

deriveAvroFromByteString [r|
{
Expand Down
15 changes: 8 additions & 7 deletions bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@

module Main where

#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
-- #if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
import qualified Bench.Deconflict as Deconflict
import qualified Bench.Encoding as Encoding
import Gauge
#endif
import Criterion.Main
-- import Gauge
-- #endif

main :: IO ()
main =
#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
-- #if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
defaultMain
[ Deconflict.values
, Encoding.encodeToBS
, Encoding.encodeContainer
, Encoding.roundtripContainer
, Deconflict.container
]
#else
return ()
#endif
-- #else
-- return ()
-- #endif
34 changes: 3 additions & 31 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
with (import <nixpkgs> {config.allowUnfree = true;});

let
vscode-overlay = self: super: {
vscode-with-extensions = super.vscode-with-extensions.override {
vscodeExtensions = with super.vscode-extensions; [
bbenoist.Nix
] ++ super.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "language-haskell";
publisher = "justusadam";
version = "2.7.0";
sha256 = "1z6nxbg1a0yvbdicib3kxl04hrxwxi3p1hmc0qfahqkf6xwcmlc5";
}
{
name = "vscode-hie-server";
publisher = "alanz";
version = "0.0.34";
sha256 = "0cipm36l3219r1yhk4j7l02mc2c0chfnv7wl44n1h0966jp1sda3";
}
];
};
};
in
with import <unstable> {
overlays = [ vscode-overlay ];
};

pkgs.mkShell {
buildInputs = with pkgs; [
zlib
ghc
haskell.compiler.ghc910
cabal-install
vscode-with-extensions

vivaldi
vivaldi-widevine
vivaldi-ffmpeg-codecs

];

shellHook = ''
Expand Down

0 comments on commit aee7c76

Please sign in to comment.