Skip to content

Commit 723c64a

Browse files
committed
hspec -> hspec-discover
1 parent 29269c1 commit 723c64a

6 files changed

Lines changed: 11 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
run: nix develop --command bash -c 'cabal update'
2626

2727
- name: Build and run tests
28-
run: nix develop --command bash -c 'cabal install hspec-discover && cabal test'
28+
run: nix develop --command bash -c 'cabal install && cabal test'

src/ArrayFire/Data.hs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ identity dims = unsafePerformIO . mask_ $ do
303303
-- 1.0000 0.0000
304304
-- 0.0000 2.0000
305305
diagCreate
306-
:: AFType (a :: *)
306+
:: AFType a
307307
=> Array a
308308
-- ^ is the input array which is the diagonal
309309
-> Int
@@ -320,7 +320,7 @@ diagCreate x (fromIntegral -> n) =
320320
-- 1.0000
321321
-- 4.0000
322322
diagExtract
323-
:: AFType (a :: *)
323+
:: AFType a
324324
=> Array a
325325
-> Int
326326
-> Array a
@@ -339,7 +339,7 @@ diagExtract x (fromIntegral -> n) =
339339
--
340340
join
341341
:: Int
342-
-> Array (a :: *)
342+
-> Array a
343343
-> Array a
344344
-> Array a
345345
join (fromIntegral -> n) arr1 arr2 = op2 arr1 arr2 (\p a b -> af_join p n a b)
@@ -385,7 +385,7 @@ withManyForeignPtr fptrs action = go [] fptrs
385385
-- 22.0000 22.0000 22.0000 22.0000 22.0000
386386
--
387387
tile
388-
:: Array (a :: *)
388+
:: Array a
389389
-> [Int]
390390
-> Array a
391391
tile a (take 4 . (++repeat 1) -> [x,y,z,w]) =
@@ -406,7 +406,7 @@ tile _ _ = error "impossible"
406406
-- 22.0000 22.0000 22.0000 22.0000 22.0000
407407
--
408408
reorder
409-
:: Array (a :: *)
409+
:: Array a
410410
-> [Int]
411411
-> Array a
412412
reorder a (take 4 . (++ repeat 0) -> [x,y,z,w]) =
@@ -424,7 +424,7 @@ reorder _ _ = error "impossible"
424424
-- 2.0000
425425
--
426426
shift
427-
:: Array (a :: *)
427+
:: Array a
428428
-> Int
429429
-> Int
430430
-> Int
@@ -441,8 +441,7 @@ shift a (fromIntegral -> x) (fromIntegral -> y) (fromIntegral -> z) (fromIntegra
441441
-- 1.0000 2.0000 3.0000
442442
--
443443
moddims
444-
:: forall a
445-
. Array (a :: *)
444+
:: Array a
446445
-> [Int]
447446
-> Array a
448447
moddims (Array fptr) dims =

src/ArrayFire/Image.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import Data.Word
2525
import ArrayFire.Internal.Types
2626
import ArrayFire.Internal.Image
2727
import ArrayFire.FFI
28-
import ArrayFire.Arith
2928

3029
-- | Calculates the gradient of an image
3130
--

src/ArrayFire/Index.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import ArrayFire.FFI
1818
import ArrayFire.Exception
1919

2020
import Foreign
21-
import Foreign.ForeignPtr (touchForeignPtr)
2221

2322
import System.IO.Unsafe
2423
import Control.Exception

src/ArrayFire/Orphans.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import Control.DeepSeq (NFData(..))
2323
import qualified ArrayFire.Arith as A
2424
import qualified ArrayFire.Array as A
2525
import qualified ArrayFire.Algorithm as A
26-
import qualified ArrayFire.Data as A
2726
import ArrayFire.Types
2827
import ArrayFire.Util
2928

test/ArrayFire/StatisticsSpec.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ spec =
8080
let (m, v) = meanVar (vector @Double 4 [1,2,3,4]) VarianceSample 0
8181
m `shouldBe` scalar @Double 2.5
8282
-- sample variance of [1,2,3,4] = 5/3 ≈ 1.6667
83-
head (toList v) `shouldBeApprox` (5.0/3.0 :: Double)
83+
case listToMaybe (toList v) of
84+
Just k -> k `shouldBeApprox` (5.0/3.0)
85+
_ -> error "failure"
8486
it "Should compute weighted mean and variance together" $ do
8587
let uniform = vector @Double 4 (repeat 1.0)
8688
(m, v) = meanVarWeighted (vector @Double 4 [1,2,3,4]) uniform VariancePopulation 0

0 commit comments

Comments
 (0)