From c40dc2c3e70fc35aa56b441374667675c73f12dc Mon Sep 17 00:00:00 2001 From: dmjio Date: Fri, 22 May 2026 17:58:13 -0500 Subject: [PATCH 1/5] Generalize `op2` type parameter. --- src/ArrayFire/FFI.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ArrayFire/FFI.hs b/src/ArrayFire/FFI.hs index 483bc0f..e776ace 100644 --- a/src/ArrayFire/FFI.hs +++ b/src/ArrayFire/FFI.hs @@ -72,7 +72,7 @@ op2 :: Array b -> Array a -> (Ptr AFArray -> AFArray -> AFArray -> IO AFErr) - -> Array a + -> Array c {-# NOINLINE op2 #-} op2 (Array fptr1) (Array fptr2) op = unsafePerformIO $ do From 973edec28a30cccdfe7928c726c329d964dc2076 Mon Sep 17 00:00:00 2001 From: "code@dmj.io" Date: Fri, 22 May 2026 21:50:36 -0500 Subject: [PATCH 2/5] Add CI --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7543e4c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install ArrayFire + run: brew install arrayfire + + - name: Set up GHC + uses: haskell-actions/setup@v2 + with: + ghc-version: '9.8.4' + cabal-version: 'latest' + + - name: Cache cabal store + uses: actions/cache@v4 + with: + path: ~/.cabal/store + key: ${{ runner.os }}-cabal-${{ hashFiles('cabal.project', '*.cabal') }} + restore-keys: | + ${{ runner.os }}-cabal- + + - name: Configure + run: cabal configure --flags="disable-default-paths disable-build-tool-depends" --extra-include-dirs=$(brew --prefix arrayfire)/include --extra-lib-dirs=$(brew --prefix arrayfire)/lib + + - name: Build + run: cabal build all + + - name: Test + run: cabal test all From 5b36ca8830fb521691e3a937a8fbb60da2ba7098 Mon Sep 17 00:00:00 2001 From: "code@dmj.io" Date: Fri, 22 May 2026 21:59:30 -0500 Subject: [PATCH 3/5] cabal install hspec-discover --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7543e4c..64f9721 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,4 +37,5 @@ jobs: run: cabal build all - name: Test + run: cabal install hspec-discover run: cabal test all From 61c2cf1a93c22b9f12c64fd2c556b4feb7426e3c Mon Sep 17 00:00:00 2001 From: "code@dmj.io" Date: Fri, 22 May 2026 22:00:39 -0500 Subject: [PATCH 4/5] hspec-discover --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64f9721..50032bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,8 +34,4 @@ jobs: run: cabal configure --flags="disable-default-paths disable-build-tool-depends" --extra-include-dirs=$(brew --prefix arrayfire)/include --extra-lib-dirs=$(brew --prefix arrayfire)/lib - name: Build - run: cabal build all - - - name: Test - run: cabal install hspec-discover - run: cabal test all + run: cabal install hspec-discover && cabal build arrayfire From 1860aa23078215aae120bf2ee6457c156e61695b Mon Sep 17 00:00:00 2001 From: "code@dmj.io" Date: Fri, 22 May 2026 22:51:40 -0500 Subject: [PATCH 5/5] `cabal test` --- .github/workflows/ci.yml | 3 ++- test/Main.hs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50032bd..88ced05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,4 +34,5 @@ jobs: run: cabal configure --flags="disable-default-paths disable-build-tool-depends" --extra-include-dirs=$(brew --prefix arrayfire)/include --extra-lib-dirs=$(brew --prefix arrayfire)/lib - name: Build - run: cabal install hspec-discover && cabal build arrayfire + run: cabal build arrayfire + diff --git a/test/Main.hs b/test/Main.hs index 34ce34d..c949527 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -20,6 +20,7 @@ instance (A.AFType a, Arbitrary a) => Arbitrary (Array a) where main :: IO () main = do + A.setBackend A.CPU -- checks (Proxy :: Proxy (A.Array (A.Complex Float))) -- checks (Proxy :: Proxy (A.Array (A.Complex Double))) -- checks (Proxy :: Proxy (A.Array Double))