hx 0.2 → 0.2.1
raw patch · 2 files changed
+9/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hx.cabal +1/−1
- src/Haskell/X.hs +8/−4
hx.cabal view
@@ -1,5 +1,5 @@ Name: hx-Version: 0.2+Version: 0.2.1 Synopsis: Utility functions that some may feel are missing from Prelude and base. Description: Utility functions that some may feel are missing from Prelude and base. .
src/Haskell/X.hs view
@@ -78,19 +78,23 @@ -- without breaking apart any subsegments. segment3 :: Int -> [[[a]]] -> [[a]] segment3 _ [] = []-segment3 size as = concatMap concat segment : segment3 size rest+segment3 size as = if null segments then [concatMap concat as]+ else concatMap concat segment : segment3 size rest where segmentations = zip (inits as) (tails as)- (segment, rest) = head $ dropWhile ((< size) . count3 . fst) segmentations+ segments = dropWhile ((< size) . count3 . fst) segmentations+ (segment, rest) = head segments -- | Segments the elements of a 2 levels deep list such that -- the segments contain at least the specified amount of elements, -- without breaking apart any subsegments. segment2 :: Int -> [[a]] -> [[a]] segment2 _ [] = []-segment2 size as = concat segment : segment2 size rest+segment2 size as = if null segments then [concat as]+ else concat segment : segment2 size rest where segmentations = zip (inits as) (tails as)- (segment, rest) = head $ dropWhile ((< size) . count2 . fst) segmentations+ segments = dropWhile ((< size) . count2 . fst) segmentations+ (segment, rest) = head segments