Skip to content

Commit

Permalink
Ensure compatibility with random-1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Oct 28, 2023
1 parent ef637b5 commit 93f60dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion massiv/src/Data/Massiv/Array/Ops/Sort.hs
Expand Up @@ -199,7 +199,7 @@ quicksortInternalM_ fLT fEQ scheduler marr
| otherwise = qsortPar depthPar 0 (k - 1)
where
-- How deep into the search tree should we continue scheduling jobs. Constants below
-- were discovered imperically:
-- were discovered empirically:
depthPar = min (logNumWorkers + 4) (logSize - 10)
k = unSz (sizeOfMArray marr)
-- We must use log becuase decinding into a tree creates an exponential number of jobs
Expand Down
3 changes: 3 additions & 0 deletions massiv/src/Data/Massiv/Core/Index/Internal.hs
Expand Up @@ -143,6 +143,9 @@ instance (UniformRange ix, Index ix) => Uniform (Sz ix) where
instance UniformRange ix => UniformRange (Sz ix) where
uniformRM (SafeSz l, SafeSz u) g = SafeSz <$> uniformRM (l, u) g
{-# INLINE uniformRM #-}
#if MIN_VERSION_random(1,3,0)
isInRange = isInRangeOrd
#endif

instance (UniformRange ix, Index ix) => Random (Sz ix)

Expand Down
6 changes: 6 additions & 0 deletions massiv/src/Data/Massiv/Core/Index/Ix.hs
Expand Up @@ -172,6 +172,9 @@ instance Uniform Ix2 where
instance UniformRange Ix2 where
uniformRM (l1 :. l2, u1 :. u2) g = (:.) <$> uniformRM (l1, u1) g <*> uniformRM (l2, u2) g
{-# INLINE uniformRM #-}
#if MIN_VERSION_random(1,3,0)
isInRange = isInRangeOrd
#endif

instance Random Ix2

Expand All @@ -182,6 +185,9 @@ instance Uniform (Ix (n - 1)) => Uniform (IxN n) where
instance UniformRange (Ix (n - 1)) => UniformRange (IxN n) where
uniformRM (l1 :> l2, u1 :> u2) g = (:>) <$> uniformRM (l1, u1) g <*> uniformRM (l2, u2) g
{-# INLINE uniformRM #-}
#if MIN_VERSION_random(1,3,0)
isInRange = isInRangeOrd
#endif

instance Random (Ix (n - 1)) => Random (IxN n) where
random g =
Expand Down

0 comments on commit 93f60dd

Please sign in to comment.