Hello community, here is the log from the commit of package ghc-split for openSUSE:Factory checked in at 2016-01-21 23:43:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-split (Old) and /work/SRC/openSUSE:Factory/.ghc-split.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-split" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-split/ghc-split.changes 2015-08-23 17:39:07.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-split.new/ghc-split.changes 2016-01-22 01:08:24.000000000 +0100 @@ -1,0 +2,8 @@ +Fri Jan 15 10:15:10 UTC 2016 - mimi...@gmail.com + +- update to 0.2.3 +* New function 'divvy' (with associated tests) from Tim Washington. +* allow base 4.9 +- drop patch split-base.patch + +------------------------------------------------------------------- Old: ---- split-0.2.2.tar.gz split-base.patch New: ---- split-0.2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-split.spec ++++++ --- /var/tmp/diff_new_pack.EKHSey/_old 2016-01-22 01:08:25.000000000 +0100 +++ /var/tmp/diff_new_pack.EKHSey/_new 2016-01-22 01:08:25.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-split # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ %bcond_with tests Name: ghc-split -Version: 0.2.2 +Version: 0.2.3 Release: 0 Summary: Combinator library for splitting lists License: BSD-3-Clause @@ -29,8 +29,6 @@ Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -# PATCH-FIX-UPSTREAM split-base.patch fix cabal file dependency on base -- mimi...@gmail.com -Patch0: split-base.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -75,7 +73,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -%patch0 -p1 %build %ghc_lib_build ++++++ split-0.2.2.tar.gz -> split-0.2.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/split-0.2.2/CHANGES new/split-0.2.3/CHANGES --- old/split-0.2.2/CHANGES 2013-04-14 20:47:17.000000000 +0200 +++ new/split-0.2.3/CHANGES 2016-01-12 16:34:45.000000000 +0100 @@ -1,3 +1,15 @@ +* 0.2.3 (12 January 2016) + + - New function 'divvy' (with associated tests) from Tim Washington. + +* 0.2.2r2 (7 Jan 2016) + + - allow base-4.9 + +* 0.2.2r1 (12 Dec 2014) + + - allow base-4.8 + * 0.2.2 (14 April 2013) - Add 'dropInnerBlanks' combinator for dropping blank chunks between diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/split-0.2.2/split.cabal new/split-0.2.3/split.cabal --- old/split-0.2.2/split.cabal 2013-04-14 20:47:17.000000000 +0200 +++ new/split-0.2.3/split.cabal 2016-01-12 16:34:45.000000000 +0100 @@ -1,5 +1,5 @@ Name: split -Version: 0.2.2 +Version: 0.2.3 Stability: stable Description: A collection of various methods for splitting @@ -31,11 +31,11 @@ Copyright: (c) Brent Yorgey, Louis Wasserman 2008-2012 Extra-source-files: README, test/Properties.hs, CHANGES Author: Brent Yorgey -Maintainer: byor...@cis.upenn.edu +Maintainer: byor...@gmail.com Category: List Build-type: Simple Cabal-Version: >= 1.10 -Tested-with: GHC ==7.0.4, GHC ==7.2.1, GHC ==7.4.*, GHC ==7.6.1 +Tested-with: GHC ==7.0.4, GHC ==7.2.1, GHC ==7.4.*, GHC ==7.6.1, GHC ==7.8.3, GHC==7.10.3 Bug-reports: http://hub.darcs.net/byorgey/split/issues Test-suite split-tests @@ -51,7 +51,7 @@ Library ghc-options: -Wall - build-depends: base <4.8 + build-depends: base <4.10 exposed-modules: Data.List.Split, Data.List.Split.Internals default-language: Haskell2010 Hs-source-dirs: src diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/split-0.2.2/src/Data/List/Split/Internals.hs new/split-0.2.3/src/Data/List/Split/Internals.hs --- old/split-0.2.2/src/Data/List/Split/Internals.hs 2013-04-14 20:47:17.000000000 +0200 +++ new/split-0.2.3/src/Data/List/Split/Internals.hs 2016-01-12 16:34:45.000000000 +0100 @@ -582,3 +582,33 @@ chop _ [] = [] chop f as = b : chop f as' where (b, as') = f as + +-- | Divides up an input list into a set of sublists, according to 'n' and 'm' +-- input specifications you provide. Each sublist will have 'n' items, and the +-- start of each sublist will be offset by 'm' items from the previous one. +-- +-- > divvy 5 5 [1..20] == [[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,18,19,20]] +-- +-- In the case where a source list's trailing elements do no fill an entire +-- sublist, those trailing elements will be dropped. +-- +-- > divvy 5 2 [1..10] == [[1,2,3,4,5],[3,4,5,6,7],[5,6,7,8,9]] +-- +-- As an example, you can generate a moving average over a list of prices: +-- +-- > type Prices = [Float] +-- > type AveragePrices = [Float] +-- > +-- > average :: [Float] -> Float +-- > average xs = sum xs / (fromIntegral $ length xs) +-- > +-- > simpleMovingAverage :: Prices -> AveragePrices +-- > simpleMovingAverage priceList = +-- > map average divvyedPrices +-- > where divvyedPrices = divvy 20 1 priceList + +divvy :: Int -> Int -> [a] -> [[a]] +divvy _ _ [] = [] +divvy n m lst = filter (\ws -> (n == length ws)) choppedl + where choppedl = chop (\xs -> (take n xs , drop m xs)) lst + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/split-0.2.2/src/Data/List/Split.hs new/split-0.2.3/src/Data/List/Split.hs --- old/split-0.2.2/src/Data/List/Split.hs 2013-04-14 20:47:17.000000000 +0200 +++ new/split-0.2.3/src/Data/List/Split.hs 2016-01-12 16:34:45.000000000 +0100 @@ -44,6 +44,7 @@ , splitPlaces , splitPlacesBlanks , chop + , divvy -- * Splitting combinators -- $comb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/split-0.2.2/test/Properties.hs new/split-0.2.3/test/Properties.hs --- old/split-0.2.2/test/Properties.hs 2013-04-14 20:47:17.000000000 +0200 +++ new/split-0.2.3/test/Properties.hs 2016-01-12 16:34:45.000000000 +0100 @@ -120,6 +120,11 @@ , ("linesBy/lines", qc prop_linesBy_lines) , ("chop/group", qc prop_chop_group) , ("chop/words", qc prop_chop_words) + , ("divvy/evenly", qc prop_divvy_evenly) + , ("divvy/discard_remainder", qc prop_divvy_discard_remainder) + , ("divvy/outputlists_allsame_length", qc prop_divvy_outputlists_allsame_length) + , ("divvy/output_are_sublists", qc prop_divvy_output_are_sublists) + , ("divvy/heads", qc prop_divvy_heads) ] prop_default_id :: [Elt] -> Bool @@ -357,3 +362,37 @@ prop_chop_words :: [EltWS] -> Bool prop_chop_words s = words s' == (filter (not . null) . chop (span (not . isSpace) . dropWhile isSpace) $ s') where s' = map unEltWS s + +prop_divvy_evenly :: [Elt] -> Positive Int -> Property +prop_divvy_evenly elems (Positive n) = (length elems `mod` n == 0) ==> concat (divvy n n elems) == elems + +prop_divvy_discard_remainder :: [Elt] -> Positive Int -> Bool +prop_divvy_discard_remainder elems (Positive n) = + concat (divvy n n elems) == (reverse . drop (length elems `mod` n) . reverse $ elems) + +prop_divvy_outputlists_allsame_length :: [Elt] -> Positive Int -> Positive Int -> Bool +prop_divvy_outputlists_allsame_length elems (Positive n) (Positive m) = allSame xs + where + allSame :: [Int] -> Bool + allSame [] = True + allSame zs = and $ map (== head zs) (tail zs) + xs = map length (divvy n m elems) + +prop_divvy_output_are_sublists :: [Elt] -> Positive Int -> Positive Int -> Bool +prop_divvy_output_are_sublists elems (Positive n) (Positive m) = and $ map (\x -> isInfixOf x elems) xs + where xs = divvy n m elems + +takeEvery :: Int -> [a] -> [a] +takeEvery _ [] = [] +takeEvery n lst = (map head . chunksOf n) $ lst + +initNth :: Int -> [a] -> [a] +initNth _ [] = [] +initNth n lst = (reverse . drop n . reverse) $ lst + +prop_divvy_heads :: [Elt] -> Positive Int -> Positive Int -> Bool +prop_divvy_heads [] _ _ = True +prop_divvy_heads elems (Positive n) (Positive m) = hds1 == hds2 + where hds1 = takeEvery m (initNth (n - 1) elems) + hds2 = map head $ divvy n m elems +