split 0.1.1 → 0.1.2
raw patch · 3 files changed
+14/−2 lines, 3 files
Files
- Data/List/Split/Internals.hs +8/−0
- Properties.hs +4/−0
- split.cabal +2/−2
Data/List/Split/Internals.hs view
@@ -445,6 +445,14 @@ -- piece will be shorter if @n@ does not evenly divide the length of -- the list. If @n <= 0@, @'splitEvery' n l@ returns an infinite list -- of empty lists.+--+-- Note that @'splitEvery' n []@ is @[]@, not @[[]]@. This is+-- intentional, and is consistent with a recursive definition of+-- 'splitEvery'; it satisfies the property that+--+-- @splitEvery n xs ++ splitEvery n ys == splitEvery n (xs ++ ys)@+--+-- whenever @n@ evenly divides the length of @xs@. splitEvery :: Int -> [e] -> [[e]] splitEvery i ls = map (take i) (build (splitter ls)) where splitter [] _ n = n
Properties.hs view
@@ -104,6 +104,7 @@ , ("splitPlaces/lengths", qc prop_splitPlaces_lengths) , ("splitPlaces/last <= n", qc prop_splitPlaces_last_less_n) , ("splitPlaces/preserve", qc prop_splitPlaces_preserve)+ , ("splitPlaces/splitEvery", qc prop_splitPlaces_splitEvery) , ("lines", qc prop_lines) , ("wordsBy/words", qc prop_wordsBy_words) , ("linesBy/lines", qc prop_linesBy_lines)@@ -284,6 +285,9 @@ prop_splitPlaces_preserve :: [NonNegative Integer] -> [Elt] -> Bool prop_splitPlaces_preserve ps l = concat (splitPlaces ps' l) == genericTake (sum ps') l where ps' = map unNN ps++prop_splitPlaces_splitEvery :: Positive Int -> [Elt] -> Bool+prop_splitPlaces_splitEvery (Positive n) l = splitPlaces (repeat n) l == splitEvery n l unNN :: NonNegative a -> a unNN (NonNegative x) = x
split.cabal view
@@ -1,5 +1,5 @@ Name: split-Version: 0.1.1+Version: 0.1.2 Stability: experimental Description: Combinator library and utility functions for splitting lists. Homepage: http://code.haskell.org/~byorgey/code/split@@ -19,5 +19,5 @@ library ghc-options: -Wall- Build-Depends: base+ Build-Depends: base <5 Exposed-Modules: Data.List.Split, Data.List.Split.Internals