diff --git a/fourmolu.yaml b/fourmolu.yaml index 5785f267..6d593233 100644 --- a/fourmolu.yaml +++ b/fourmolu.yaml @@ -12,3 +12,4 @@ in-style: right-align unicode: never respectful: true fixities: [] +single-constraint-parens: never diff --git a/massiv/src/Data/Massiv/Array/Ops/Sort.hs b/massiv/src/Data/Massiv/Array/Ops/Sort.hs index 10a42439..c0fe984e 100644 --- a/massiv/src/Data/Massiv/Array/Ops/Sort.hs +++ b/massiv/src/Data/Massiv/Array/Ops/Sort.hs @@ -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 diff --git a/massiv/src/Data/Massiv/Core/Index/Internal.hs b/massiv/src/Data/Massiv/Core/Index/Internal.hs index 45921380..98b74508 100644 --- a/massiv/src/Data/Massiv/Core/Index/Internal.hs +++ b/massiv/src/Data/Massiv/Core/Index/Internal.hs @@ -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 (SafeSz l, SafeSz u) (SafeSz k) = isInRange (l, u) k +#endif instance (UniformRange ix, Index ix) => Random (Sz ix) @@ -365,6 +368,9 @@ instance Uniform Dim where instance UniformRange Dim where uniformRM r g = Dim <$> uniformRM (coerce r) g +#if MIN_VERSION_random(1,3,0) + isInRange = isInRangeOrd +#endif instance Random Dim @@ -736,7 +742,7 @@ class -- @since 1.0.2 iterF :: ix -> ix -> ix -> (Int -> Int -> Bool) -> f a -> (ix -> f a -> f a) -> f a default iterF - :: (Index (Lower ix)) + :: Index (Lower ix) => ix -> ix -> ix @@ -758,7 +764,7 @@ class -- @since 0.1.0 stepNextMF :: ix -> ix -> ix -> (Int -> Int -> Bool) -> (Maybe ix -> f a) -> f a default stepNextMF - :: (Index (Lower ix)) + :: Index (Lower ix) => ix -> ix -> ix diff --git a/massiv/src/Data/Massiv/Core/Index/Ix.hs b/massiv/src/Data/Massiv/Core/Index/Ix.hs index 3041c22e..896336cd 100644 --- a/massiv/src/Data/Massiv/Core/Index/Ix.hs +++ b/massiv/src/Data/Massiv/Core/Index/Ix.hs @@ -172,6 +172,10 @@ 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 (l1 :. l2, u1 :. u2) (i1 :. i2) = + isInRangeOrd (l1, u1) i1 && isInRangeOrd (l2, u2) i2 +#endif instance Random Ix2 @@ -182,6 +186,10 @@ 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 (l1 :> l2, u1 :> u2) (i1 :> i2) = + isInRangeOrd (l1, u1) i1 && isInRange (l2, u2) i2 +#endif instance Random (Ix (n - 1)) => Random (IxN n) where random g =