diff --git a/.ghci b/.ghci index 3801274..4ef1af0 100644 --- a/.ghci +++ b/.ghci @@ -4,3 +4,4 @@ :m - ArrayFire import qualified ArrayFire as A :set -laf +:set -isrc:test diff --git a/.gitignore b/.gitignore index ea41227..aee1772 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ result/ *~ /ctags cabal.project.local -tags \ No newline at end of file +tags +/.stack-work/ diff --git a/arrayfire.cabal b/arrayfire.cabal index 9a04609..22d2fd4 100644 --- a/arrayfire.cabal +++ b/arrayfire.cabal @@ -1,16 +1,16 @@ +cabal-version: 3.0 name: arrayfire -version: 0.6.0.0 +version: 0.7.0.0 synopsis: Haskell bindings to the ArrayFire general-purpose GPU library homepage: https://github.com/arrayfire/arrayfire-haskell -license: BSD3 +license: BSD-3-Clause license-file: LICENSE author: David Johnson maintainer: djohnson.m@gmail.com -copyright: David Johnson (c) 2018-2020 +copyright: David Johnson (c) 2018-2023 category: Math build-type: Custom extra-source-files: CHANGELOG.md -cabal-version: >=1.10 description: High-level Haskell bindings to the ArrayFire General-purpose GPU library . <> @@ -75,8 +75,8 @@ library ArrayFire.Internal.Types ArrayFire.Internal.Util ArrayFire.Internal.Vision - build-tools: - hsc2hs + build-tool-depends: + hsc2hs:hsc2hs extra-libraries: af c-sources: diff --git a/default.nix b/default.nix index cc496ab..dc282d7 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,6 @@ let pkg = pkgs.haskellPackages.callCabal2nix "arrayfire" ./. { af = null; - quickcheck-classes = pkgs.haskellPackages.quickcheck-classes_0_6_4_0; }; in pkg diff --git a/shell.nix b/shell.nix index effe186..94b11d9 100644 --- a/shell.nix +++ b/shell.nix @@ -11,13 +11,13 @@ in ${pkgs.haskellPackages.ghcid.bin}/bin/ghcid -c 'cabal v1-repl lib:arrayfire' }; function test-runner () { - ${pkgs.ag}/bin/ag -l | \ + ${pkgs.silver-searcher}/bin/ag -l | \ ${pkgs.entr}/bin/entr sh -c \ 'cabal v1-configure --enable-tests && \ cabal v1-build test && dist/build/test/test' } function doctest-runner () { - ${pkgs.ag}/bin/ag -l | \ + ${pkgs.silver-searcher}/bin/ag -l | \ ${pkgs.entr}/bin/entr sh -c \ 'cabal v1-configure --enable-tests && \ cabal v1-build doctests && dist/build/doctests/doctests src/ArrayFire/Algorithm.hs' diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..65dfe28 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,5 @@ +resolver: + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml + +packages: +- . diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..fd29b3e --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,13 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: [] +snapshots: +- completed: + size: 619403 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml + sha256: 1ecad1f0bd2c27de88dbff6572446cfdf647c615d58a7e2e2085c6b7dfc04176 + original: + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml diff --git a/test/ArrayFire/AlgorithmSpec.hs b/test/ArrayFire/AlgorithmSpec.hs index 0541372..6e5b4d6 100644 --- a/test/ArrayFire/AlgorithmSpec.hs +++ b/test/ArrayFire/AlgorithmSpec.hs @@ -63,7 +63,7 @@ spec = A.product (A.vector @Double 10 [1..]) 0 `shouldBe` 3628800.0 A.product (A.vector @(A.Complex Double) 10 (repeat (1 A.:+ 1))) 0 `shouldBe` A.scalar (0.0 A.:+ 32.0) A.product (A.vector @(A.Complex Float) 10 (repeat (1 A.:+ 1))) 0 `shouldBe` A.scalar (0.0 A.:+ 32.0) - A.product (A.vector @A.CBool 10 (repeat 1)) 0 `shouldBe` 10 -- FIXME: This is a bug, should be 0 + A.product (A.vector @A.CBool 10 (repeat 1)) 0 `shouldBe` 1 -- FIXED in 3.8.2, vector product along 0-axis is 1 for vector size 10 of all 1's. A.product (A.vector @A.CBool 10 (repeat 0)) 0 `shouldBe` 0 it "Should product a default value to replace NaN" $ do A.productNaN (A.vector @Float 10 [1..]) 0 1.0 `shouldBe` 3628800.0 @@ -100,7 +100,7 @@ spec = it "Should get sum all elements" $ do A.sumAll (A.vector @Int 5 (repeat 2)) `shouldBe` (10,0) A.sumAll (A.vector @Double 5 (repeat 2)) `shouldBe` (10.0,0) - -- A.sumAll (A.vector @A.CBool 3800 (repeat 1)) `shouldBe` (3800,0) -- causes strange behavior + A.sumAll (A.vector @A.CBool 3800 (repeat 1)) `shouldBe` (3800,0) A.sumAll (A.vector @(A.Complex Double) 5 (repeat (2 A.:+ 0))) `shouldBe` (10.0,0) it "Should get sum all elements" $ do A.sumNaNAll (A.vector @Double 2 [10, acos 2]) 1 `shouldBe` (11.0,0) diff --git a/test/ArrayFire/StatisticsSpec.hs b/test/ArrayFire/StatisticsSpec.hs index 49280fe..392f617 100644 --- a/test/ArrayFire/StatisticsSpec.hs +++ b/test/ArrayFire/StatisticsSpec.hs @@ -20,7 +20,7 @@ spec = it "Should find the variance" $ do var (vector @Double 8 [1..8]) False 0 `shouldBe` - 6.0 + 5.25 it "Should find the weighted variance" $ do varWeighted (vector @Double 8 [1..]) (vector @Double 8 (repeat 1)) 0 `shouldBe` diff --git a/test/ArrayFire/UtilSpec.hs b/test/ArrayFire/UtilSpec.hs index 7ac7dc4..9ff01dc 100644 --- a/test/ArrayFire/UtilSpec.hs +++ b/test/ArrayFire/UtilSpec.hs @@ -31,7 +31,7 @@ spec = A.getSizeOf (Proxy @(Complex Double)) `shouldBe` 16 it "Should get version" $ do x <- A.getVersion - x `shouldBe` (3,6,4) + x `shouldBe` (3,8,2) it "Should get revision" $ do x <- A.getRevision x `shouldSatisfy` (not . null)