Skip to content

Commit d1778bc

Browse files
authored
Fix compilation on GHC 9.0.2 (#50)
1 parent 5d62160 commit d1778bc

File tree

8 files changed

+29
-28
lines changed

8 files changed

+29
-28
lines changed

arrayfire.cabal

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ test-suite test
145145
base < 5,
146146
directory,
147147
hspec,
148-
hspec-discover,
149148
QuickCheck,
150149
quickcheck-classes,
151150
vector
151+
build-tool-depends:
152+
hspec-discover:hspec-discover
152153
default-language:
153154
Haskell2010
154155
other-modules:

src/ArrayFire/Arith.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ cast
719719
cast afArr =
720720
coerce $ afArr `op1` (\x y -> af_cast x y dtyp)
721721
where
722-
dtyp = afType (Proxy @ b)
722+
dtyp = afType (Proxy @b)
723723

724724
-- | Find the minimum of two 'Array's
725725
--

src/ArrayFire/Array.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ mkArray dims xs =
196196
Array <$> newForeignPtr af_release_array_finalizer arr
197197
where
198198
size = Prelude.product dims
199-
dType = afType (Proxy @ array)
199+
dType = afType (Proxy @array)
200200

201201
-- af_err af_create_handle(af_array *arr, const unsigned ndims, const dim_t * const dims, const af_dtype type);
202202

@@ -482,7 +482,7 @@ toVector :: forall a . AFType a => Array a -> Vector a
482482
toVector arr@(Array fptr) = do
483483
unsafePerformIO . mask_ . withForeignPtr fptr $ \arrPtr -> do
484484
let len = getElements arr
485-
size = len * getSizeOf (Proxy @ a)
485+
size = len * getSizeOf (Proxy @a)
486486
ptr <- mallocBytes (len * size)
487487
throwAFError =<< af_get_data_ptr (castPtr ptr) arrPtr
488488
newFptr <- newForeignPtr finalizerFree ptr

src/ArrayFire/Data.hs

+6-6
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ constant dims val =
9191
cast $ constant' dims (realToFrac (unsafeCoerce val :: Float))
9292
| otherwise -> error "constant: Invalid array fire type"
9393
where
94-
dtyp = afType (Proxy @ a)
94+
dtyp = afType (Proxy @a)
9595

9696
constant'
9797
:: [Int]
@@ -112,7 +112,7 @@ constant dims val =
112112
ptr
113113
where
114114
n = fromIntegral (length dims')
115-
typ = afType (Proxy @ Double)
115+
typ = afType (Proxy @Double)
116116

117117
-- | Creates an 'Array (Complex Double)' from a scalar val'ue
118118
--
@@ -139,7 +139,7 @@ constant dims val =
139139
ptr
140140
where
141141
n = fromIntegral (length dims')
142-
typ = afType (Proxy @ (Complex arr))
142+
typ = afType (Proxy @(Complex arr))
143143

144144
-- | Creates an 'Array Int64' from a scalar val'ue
145145
--
@@ -221,7 +221,7 @@ range dims (fromIntegral -> k) = unsafePerformIO $ do
221221
ptr
222222
where
223223
n = fromIntegral (length dims)
224-
typ = afType (Proxy @ a)
224+
typ = afType (Proxy @a)
225225

226226
-- | Create an sequence [0, dims.elements() - 1] and modify to specified dimensions dims and then tile it according to tile_dims.
227227
--
@@ -266,7 +266,7 @@ iota dims tdims = unsafePerformIO $ do
266266
af_release_array_finalizer
267267
ptr
268268
where
269-
typ = afType (Proxy @ a)
269+
typ = afType (Proxy @a)
270270

271271
-- | Creates the identity `Array` from given dimensions
272272
--
@@ -293,7 +293,7 @@ identity dims = unsafePerformIO . mask_ $ do
293293
ptr
294294
where
295295
n = fromIntegral (length dims)
296-
typ = afType (Proxy @ a)
296+
typ = afType (Proxy @a)
297297

298298
-- | Create a diagonal matrix from input array when extract is set to false
299299
--

src/ArrayFire/Image.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ regions
423423
regions in' (fromConnectivity -> conn) =
424424
in' `op1` (\ptr k -> af_regions ptr k conn dtype)
425425
where
426-
dtype = afType (Proxy @ a)
426+
dtype = afType (Proxy @a)
427427

428428
-- | Sobel Operators.
429429
--

src/ArrayFire/Random.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ randEng dims f (RandomEngine fptr) = mask_ $
240240
ptr
241241
where
242242
n = fromIntegral (length dims)
243-
typ = afType (Proxy @ a)
243+
typ = afType (Proxy @a)
244244

245245
rand
246246
:: forall a . AFType a
@@ -260,7 +260,7 @@ rand dims f = mask_ $ do
260260
ptr
261261
where
262262
n = fromIntegral (length dims)
263-
typ = afType (Proxy @ a)
263+
typ = afType (Proxy @a)
264264

265265
-- | Generate random 'Array'
266266
--

src/ArrayFire/Vision.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,4 @@ homography
360360
(,) <$> do fromIntegral <$> peek outPtrI
361361
<*> do Array <$> newForeignPtr af_release_array_finalizer arrayPtr
362362
where
363-
dtype = afType (Proxy @ a)
363+
dtype = afType (Proxy @a)

test/ArrayFire/UtilSpec.hs

+14-14
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ spec :: Spec
1515
spec =
1616
describe "Util spec" $ do
1717
it "Should get size of" $ do
18-
A.getSizeOf (Proxy @ Int) `shouldBe` 8
19-
A.getSizeOf (Proxy @ Int64) `shouldBe` 8
20-
A.getSizeOf (Proxy @ Int32) `shouldBe` 4
21-
A.getSizeOf (Proxy @ Int16) `shouldBe` 2
22-
A.getSizeOf (Proxy @ Word) `shouldBe` 8
23-
A.getSizeOf (Proxy @ Word64) `shouldBe` 8
24-
A.getSizeOf (Proxy @ Word32) `shouldBe` 4
25-
A.getSizeOf (Proxy @ Word16) `shouldBe` 2
26-
A.getSizeOf (Proxy @ Word8) `shouldBe` 1
27-
A.getSizeOf (Proxy @ CBool) `shouldBe` 1
28-
A.getSizeOf (Proxy @ Double) `shouldBe` 8
29-
A.getSizeOf (Proxy @ Float) `shouldBe` 4
30-
A.getSizeOf (Proxy @ (Complex Float)) `shouldBe` 8
31-
A.getSizeOf (Proxy @ (Complex Double)) `shouldBe` 16
18+
A.getSizeOf (Proxy @Int) `shouldBe` 8
19+
A.getSizeOf (Proxy @Int64) `shouldBe` 8
20+
A.getSizeOf (Proxy @Int32) `shouldBe` 4
21+
A.getSizeOf (Proxy @Int16) `shouldBe` 2
22+
A.getSizeOf (Proxy @Word) `shouldBe` 8
23+
A.getSizeOf (Proxy @Word64) `shouldBe` 8
24+
A.getSizeOf (Proxy @Word32) `shouldBe` 4
25+
A.getSizeOf (Proxy @Word16) `shouldBe` 2
26+
A.getSizeOf (Proxy @Word8) `shouldBe` 1
27+
A.getSizeOf (Proxy @CBool) `shouldBe` 1
28+
A.getSizeOf (Proxy @Double) `shouldBe` 8
29+
A.getSizeOf (Proxy @Float) `shouldBe` 4
30+
A.getSizeOf (Proxy @(Complex Float)) `shouldBe` 8
31+
A.getSizeOf (Proxy @(Complex Double)) `shouldBe` 16
3232
it "Should get version" $ do
3333
x <- A.getVersion
3434
x `shouldBe` (3,6,4)

0 commit comments

Comments
 (0)