Skip to content

Commit 50ce116

Browse files
authored
Generalize op2 type parameter. (#64)
* Generalize `op2` type parameter. * Add CI * cabal install hspec-discover * hspec-discover * `cabal test`
1 parent fa580dd commit 50ce116

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install ArrayFire
17+
run: brew install arrayfire
18+
19+
- name: Set up GHC
20+
uses: haskell-actions/setup@v2
21+
with:
22+
ghc-version: '9.8.4'
23+
cabal-version: 'latest'
24+
25+
- name: Cache cabal store
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.cabal/store
29+
key: ${{ runner.os }}-cabal-${{ hashFiles('cabal.project', '*.cabal') }}
30+
restore-keys: |
31+
${{ runner.os }}-cabal-
32+
33+
- name: Configure
34+
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
35+
36+
- name: Build
37+
run: cabal build arrayfire
38+

src/ArrayFire/FFI.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ op2
7272
:: Array b
7373
-> Array a
7474
-> (Ptr AFArray -> AFArray -> AFArray -> IO AFErr)
75-
-> Array a
75+
-> Array c
7676
{-# NOINLINE op2 #-}
7777
op2 (Array fptr1) (Array fptr2) op =
7878
unsafePerformIO $ do

test/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ instance (A.AFType a, Arbitrary a) => Arbitrary (Array a) where
2020

2121
main :: IO ()
2222
main = do
23+
A.setBackend A.CPU
2324
-- checks (Proxy :: Proxy (A.Array (A.Complex Float)))
2425
-- checks (Proxy :: Proxy (A.Array (A.Complex Double)))
2526
-- checks (Proxy :: Proxy (A.Array Double))

0 commit comments

Comments
 (0)