chunk-calculation-fix

This commit is contained in:
Dmitry Zuikov 2023-04-11 18:54:34 +03:00
parent c47c6dee87
commit cbb084f5d9
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@ calcChunks :: forall a b . (Integral a, Integral b)
calcChunks s1 s2 = fmap (over _1 fromIntegral . over _2 fromIntegral) chu calcChunks s1 s2 = fmap (over _1 fromIntegral . over _2 fromIntegral) chu
where where
chu = fmap (,s2) (takeWhile (<s1) $ iterate (+s2) 0) (n,rest) = s1 `divMod` s2
chu = [ (x*s2,s2) | x <- [0..n-1] ] <> [(n * s2, rest) | rest > 0]