Hello community, here is the log from the commit of package ghc-identicon for openSUSE:Factory checked in at 2017-05-10 20:48:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-identicon (Old) and /work/SRC/openSUSE:Factory/.ghc-identicon.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-identicon" Wed May 10 20:48:13 2017 rev:2 rq:489357 version:0.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-identicon/ghc-identicon.changes 2017-04-12 18:07:08.270978800 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-identicon.new/ghc-identicon.changes 2017-05-10 20:48:14.442124008 +0200 @@ -1,0 +2,5 @@ +Tue Apr 4 11:04:06 UTC 2017 - [email protected] + +- Update to version 0.2.1 with cabal2obs. + +------------------------------------------------------------------- Old: ---- identicon-0.2.0.tar.gz New: ---- identicon-0.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-identicon.spec ++++++ --- /var/tmp/diff_new_pack.WLJUTF/_old 2017-05-10 20:48:15.290004367 +0200 +++ /var/tmp/diff_new_pack.WLJUTF/_new 2017-05-10 20:48:15.290004367 +0200 @@ -19,7 +19,7 @@ %global pkg_name identicon %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.2.0 +Version: 0.2.1 Release: 0 Summary: Flexible generation of identicons License: BSD-3-Clause @@ -32,6 +32,7 @@ BuildRequires: ghc-rpm-macros BuildRoot: %{_tmppath}/%{name}-%{version}-build %if %{with tests} +BuildRequires: ghc-QuickCheck-devel BuildRequires: ghc-hspec-devel %endif ++++++ identicon-0.2.0.tar.gz -> identicon-0.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/CHANGELOG.md new/identicon-0.2.1/CHANGELOG.md --- old/identicon-0.2.0/CHANGELOG.md 2016-10-19 11:53:47.000000000 +0200 +++ new/identicon-0.2.1/CHANGELOG.md 2017-03-28 07:56:52.000000000 +0200 @@ -1,3 +1,7 @@ +## Identicon 0.2.1 + +* Added `Semigroup` and `Monoid` instances for `Layer`. + ## Identicon 0.2.0 * Added benchmarks. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/Graphics/Identicon/Primitive.hs new/identicon-0.2.1/Graphics/Identicon/Primitive.hs --- old/identicon-0.2.0/Graphics/Identicon/Primitive.hs 2016-10-19 11:51:32.000000000 +0200 +++ new/identicon-0.2.1/Graphics/Identicon/Primitive.hs 2017-01-01 11:58:15.000000000 +0100 @@ -1,6 +1,6 @@ -- | -- Module : Graphics.Identicon.Primitive --- Copyright : © 2016 Mark Karpov +-- Copyright : © 2016–2017 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/Graphics/Identicon.hs new/identicon-0.2.1/Graphics/Identicon.hs --- old/identicon-0.2.0/Graphics/Identicon.hs 2016-10-19 11:51:32.000000000 +0200 +++ new/identicon-0.2.1/Graphics/Identicon.hs 2017-03-28 08:11:09.000000000 +0200 @@ -1,6 +1,6 @@ -- | -- Module : Graphics.Identicon --- Copyright : © 2016 Mark Karpov +-- Copyright : © 2016–2017 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <[email protected]> @@ -40,6 +40,7 @@ -- black. The circle is mirrored 4 times, and every repetition is rotated by -- 90°. This identicon consumes 4 bytes and has one layer. +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -73,6 +74,11 @@ import Data.Word (Word8) import GHC.TypeLits import qualified Data.ByteString as B +import qualified Data.Semigroup as S + +#if !MIN_VERSION_base(4,8,0) +import Data.Monoid +#endif ---------------------------------------------------------------------------- -- Basic types @@ -123,6 +129,13 @@ newtype Layer = Layer { unLayer :: Int -> Int -> Int -> Int -> PixelRGB8 } +instance S.Semigroup Layer where + Layer a <> Layer b = Layer (\w h -> mixPixels (a w h) (b w h)) + +instance Monoid Layer where + mempty = Layer $ \_ _ _ _ -> PixelRGB8 0 0 0 + mappend = (S.<>) + -- | The 'BytesAvailable' type function calculates how many bytes available -- for consumption in a given identicon. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/LICENSE.md new/identicon-0.2.1/LICENSE.md --- old/identicon-0.2.0/LICENSE.md 2016-01-03 14:37:56.000000000 +0100 +++ new/identicon-0.2.1/LICENSE.md 2017-01-01 11:58:33.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright © 2016 Mark Karpov +Copyright © 2016–2017 Mark Karpov All rights reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/README.md new/identicon-0.2.1/README.md --- old/identicon-0.2.0/README.md 2016-05-28 14:09:52.000000000 +0200 +++ new/identicon-0.2.1/README.md 2017-01-01 11:58:39.000000000 +0100 @@ -92,6 +92,6 @@ ## License -Copyright © 2016 Mark Karpov +Copyright © 2016–2017 Mark Karpov Distributed under BSD 3 clause license. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/bench/Main.hs new/identicon-0.2.1/bench/Main.hs --- old/identicon-0.2.0/bench/Main.hs 2016-10-19 11:51:25.000000000 +0200 +++ new/identicon-0.2.1/bench/Main.hs 2017-01-01 11:58:02.000000000 +0100 @@ -1,7 +1,7 @@ -- -- Benchmarks for the ‘identicon’ package. -- --- Copyright © 2016 Mark Karpov <[email protected]> +-- Copyright © 2016–2017 Mark Karpov <[email protected]> -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/identicon.cabal new/identicon-0.2.1/identicon.cabal --- old/identicon-0.2.0/identicon.cabal 2016-10-19 11:54:42.000000000 +0200 +++ new/identicon-0.2.1/identicon.cabal 2017-03-28 08:41:33.000000000 +0200 @@ -1,7 +1,7 @@ -- -- Cabal configuration for ‘identicon’ package. -- --- Copyright © 2016 Mark Karpov <[email protected]> +-- Copyright © 2016–2017 Mark Karpov <[email protected]> -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are @@ -31,7 +31,7 @@ -- POSSIBILITY OF SUCH DAMAGE. name: identicon -version: 0.2.0 +version: 0.2.1 cabal-version: >= 1.10 license: BSD3 license-file: LICENSE.md @@ -60,6 +60,8 @@ build-depends: base >= 4.7 && < 5.0 , JuicyPixels >= 3.2.6.5 && < 4.0 , bytestring >= 0.10.6 && < 0.13 + if !impl(ghc >= 8.0) + build-depends: semigroups == 0.18.* exposed-modules: Graphics.Identicon , Graphics.Identicon.Primitive if flag(dev) @@ -72,11 +74,14 @@ main-is: Spec.hs hs-source-dirs: tests type: exitcode-stdio-1.0 - build-depends: base >= 4.7 && < 5.0 - , JuicyPixels >= 3.2.6.5 && < 4.0 + build-depends: JuicyPixels >= 3.2.6.5 && < 4.0 + , QuickCheck >= 2.7 && < 3.0 + , base >= 4.7 && < 5.0 , bytestring >= 0.10.6 && < 0.13 , hspec >= 2.0 && < 3.0 - , identicon >= 0.2.0 + , identicon >= 0.2.1 + if !impl(ghc >= 8.0) + build-depends: semigroups == 0.18.* if flag(dev) ghc-options: -Wall -Werror else @@ -91,7 +96,7 @@ , JuicyPixels >= 3.2.6.5 && < 4.0 , bytestring >= 0.10.6 && < 0.13 , criterion >= 0.6.2.1 && < 1.2 - , identicon >= 0.2.0 + , identicon >= 0.2.1 , random >= 1.1 && < 1.2 , tf-random >= 0.4 && < 0.6 if flag(dev) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/identicon-0.2.0/tests/Spec.hs new/identicon-0.2.1/tests/Spec.hs --- old/identicon-0.2.0/tests/Spec.hs 2016-10-19 11:51:32.000000000 +0200 +++ new/identicon-0.2.1/tests/Spec.hs 2017-03-28 08:21:02.000000000 +0200 @@ -1,7 +1,7 @@ -- -- Tests for the ‘identicon’ package. -- --- Copyright © 2016 Mark Karpov <[email protected]> +-- Copyright © 2016–2017 Mark Karpov <[email protected]> -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are @@ -30,6 +30,7 @@ -- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeOperators #-} @@ -45,8 +46,13 @@ import Graphics.Identicon import Graphics.Identicon.Primitive import Test.Hspec +import Test.QuickCheck hiding (oneof) import qualified Data.ByteString as B +#if !MIN_VERSION_base(4,8,0) +import Data.Monoid +#endif + main :: IO () main = hspec spec @@ -68,6 +74,26 @@ "data-examples/identicon-21.png" ω gen2 [0xf9,0x9b,0xb7,0x11,0x5b,0xca,0x00] "data-examples/identicon-22.png" + describe "Semigroup and Monoid instances of Layer" $ do + it "mempty always returns black pixel" $ + property $ \w h x y -> + let (Layer f) = mempty + in f w h x y `shouldBe` PixelRGB8 0 0 0 + it "mappend combines layers" $ + property $ \w'' h'' x'' y'' -> + let w = w'' `mod` 10 + h = h'' `mod` 10 + x = x'' `mod` 10 + y = y'' `mod` 10 + (Layer f) = Layer a `mappend` Layer b + a w' h' x' y' = PixelRGB8 (g $ w' + h') (g $ h' + x') (g $ x' + y') + b w' h' x' y' = PixelRGB8 (g $ w' + y') (g $ h' + w') (g $ x' + w') + g = fromIntegral + in f w h x y + `shouldBe` PixelRGB8 + (g $ w + h + w + y) + (g $ h + x + h + w) + (g $ x + y + x + w) renderIdenticonSpec :: Spec renderIdenticonSpec = do
