Skip to content

Commit 8dd8494

Browse files
committed
Major bump to use latest GHC and version 3.8.2 of ArrayFire.
- Adds stack.yaml - 3.8.2 bump fixes variance and product calculations in arrayfire-haskell tests - Tests on latest GHC versions
1 parent d1778bc commit 8dd8494

10 files changed

+33
-14
lines changed

.ghci

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
:m - ArrayFire
55
import qualified ArrayFire as A
66
:set -laf
7+
:set -isrc:test

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ result/
55
*~
66
/ctags
77
cabal.project.local
8-
tags
8+
tags
9+
/.stack-work/

arrayfire.cabal

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
cabal-version: 3.0
12
name: arrayfire
2-
version: 0.6.0.0
3+
version: 0.7.0.0
34
synopsis: Haskell bindings to the ArrayFire general-purpose GPU library
45
homepage: https://github.com/arrayfire/arrayfire-haskell
5-
license: BSD3
6+
license: BSD-3-Clause
67
license-file: LICENSE
78
author: David Johnson
89
maintainer: djohnson.m@gmail.com
9-
copyright: David Johnson (c) 2018-2020
10+
copyright: David Johnson (c) 2018-2023
1011
category: Math
1112
build-type: Custom
1213
extra-source-files: CHANGELOG.md
13-
cabal-version: >=1.10
1414
description: High-level Haskell bindings to the ArrayFire General-purpose GPU library
1515
.
1616
<<https://user-images.githubusercontent.com/875324/59819388-9ff83f00-92f5-11e9-9ac0-51eef200c716.png>>
@@ -75,8 +75,8 @@ library
7575
ArrayFire.Internal.Types
7676
ArrayFire.Internal.Util
7777
ArrayFire.Internal.Vision
78-
build-tools:
79-
hsc2hs
78+
build-tool-depends:
79+
hsc2hs:hsc2hs
8080
extra-libraries:
8181
af
8282
c-sources:

default.nix

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
let
44
pkg = pkgs.haskellPackages.callCabal2nix "arrayfire" ./. {
55
af = null;
6-
quickcheck-classes = pkgs.haskellPackages.quickcheck-classes_0_6_4_0;
76
};
87
in
98
pkg

shell.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ in
1111
${pkgs.haskellPackages.ghcid.bin}/bin/ghcid -c 'cabal v1-repl lib:arrayfire'
1212
};
1313
function test-runner () {
14-
${pkgs.ag}/bin/ag -l | \
14+
${pkgs.silver-searcher}/bin/ag -l | \
1515
${pkgs.entr}/bin/entr sh -c \
1616
'cabal v1-configure --enable-tests && \
1717
cabal v1-build test && dist/build/test/test'
1818
}
1919
function doctest-runner () {
20-
${pkgs.ag}/bin/ag -l | \
20+
${pkgs.silver-searcher}/bin/ag -l | \
2121
${pkgs.entr}/bin/entr sh -c \
2222
'cabal v1-configure --enable-tests && \
2323
cabal v1-build doctests && dist/build/doctests/doctests src/ArrayFire/Algorithm.hs'

stack.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resolver:
2+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml
3+
4+
packages:
5+
- .

stack.yaml.lock

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was autogenerated by Stack.
2+
# You should not edit this file by hand.
3+
# For more information, please see the documentation at:
4+
# https://docs.haskellstack.org/en/stable/lock_files
5+
6+
packages: []
7+
snapshots:
8+
- completed:
9+
size: 619403
10+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml
11+
sha256: 1ecad1f0bd2c27de88dbff6572446cfdf647c615d58a7e2e2085c6b7dfc04176
12+
original:
13+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml

test/ArrayFire/AlgorithmSpec.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ spec =
6363
A.product (A.vector @Double 10 [1..]) 0 `shouldBe` 3628800.0
6464
A.product (A.vector @(A.Complex Double) 10 (repeat (1 A.:+ 1))) 0 `shouldBe` A.scalar (0.0 A.:+ 32.0)
6565
A.product (A.vector @(A.Complex Float) 10 (repeat (1 A.:+ 1))) 0 `shouldBe` A.scalar (0.0 A.:+ 32.0)
66-
A.product (A.vector @A.CBool 10 (repeat 1)) 0 `shouldBe` 10 -- FIXME: This is a bug, should be 0
66+
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.
6767
A.product (A.vector @A.CBool 10 (repeat 0)) 0 `shouldBe` 0
6868
it "Should product a default value to replace NaN" $ do
6969
A.productNaN (A.vector @Float 10 [1..]) 0 1.0 `shouldBe` 3628800.0
@@ -100,7 +100,7 @@ spec =
100100
it "Should get sum all elements" $ do
101101
A.sumAll (A.vector @Int 5 (repeat 2)) `shouldBe` (10,0)
102102
A.sumAll (A.vector @Double 5 (repeat 2)) `shouldBe` (10.0,0)
103-
-- A.sumAll (A.vector @A.CBool 3800 (repeat 1)) `shouldBe` (3800,0) -- causes strange behavior
103+
A.sumAll (A.vector @A.CBool 3800 (repeat 1)) `shouldBe` (3800,0)
104104
A.sumAll (A.vector @(A.Complex Double) 5 (repeat (2 A.:+ 0))) `shouldBe` (10.0,0)
105105
it "Should get sum all elements" $ do
106106
A.sumNaNAll (A.vector @Double 2 [10, acos 2]) 1 `shouldBe` (11.0,0)

test/ArrayFire/StatisticsSpec.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec =
2020
it "Should find the variance" $ do
2121
var (vector @Double 8 [1..8]) False 0
2222
`shouldBe`
23-
6.0
23+
5.25
2424
it "Should find the weighted variance" $ do
2525
varWeighted (vector @Double 8 [1..]) (vector @Double 8 (repeat 1)) 0
2626
`shouldBe`

test/ArrayFire/UtilSpec.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec =
3131
A.getSizeOf (Proxy @(Complex Double)) `shouldBe` 16
3232
it "Should get version" $ do
3333
x <- A.getVersion
34-
x `shouldBe` (3,6,4)
34+
x `shouldBe` (3,8,2)
3535
it "Should get revision" $ do
3636
x <- A.getRevision
3737
x `shouldSatisfy` (not . null)

0 commit comments

Comments
 (0)