Hello community, here is the log from the commit of package ghc-semigroups for openSUSE:Factory checked in at 2015-05-21 08:13:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-semigroups (Old) and /work/SRC/openSUSE:Factory/.ghc-semigroups.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-semigroups" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-semigroups/ghc-semigroups.changes 2014-11-26 20:55:31.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-semigroups.new/ghc-semigroups.changes 2015-05-21 08:13:06.000000000 +0200 @@ -1,0 +2,14 @@ +Tue Apr 21 20:21:30 UTC 2015 - [email protected] + +- update to 0.16.2.2 +* Added `genericMappend` and supporting `GSemigroup` class for generically deriving Semigroup instances. +* Added `Arg a b` which only compares for equality/order on its first argument, which + can be used to compute `argmin` and `argmax`. +* Add `Bifunctor` `Arg` instance to avoid orphans for GHC 7.10+. +* Added missing `Data.Monoid.Generic` module to source control. +* Added `Semigroup` instances for various Builder constructions in `text` and `bytestring` where available. +* Added `MonadFix` and `MonadPlus` instances for `NonEmpty`. +* `times1p` and `timesN` are now reduced to accepting only a `Natural` argument. + `Whole` doesn't exist in GHC 7.10's Numeric.Natural, and `nats` version 1 has removed support for the class. + +------------------------------------------------------------------- Old: ---- _service semigroups-0.15.4.tar.gz New: ---- semigroups-0.16.2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-semigroups.spec ++++++ --- /var/tmp/diff_new_pack.5FOctE/_old 2015-05-21 08:13:07.000000000 +0200 +++ /var/tmp/diff_new_pack.5FOctE/_new 2015-05-21 08:13:07.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-semigroups # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 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 @@ -18,15 +18,15 @@ %global pkg_name semigroups -Name: ghc-semigroups -Version: 0.15.4 +Name: ghc-%{pkg_name} +Version: 0.16.2.2 Release: 0 Summary: Anything that associates -License: BSD-2-Clause +License: BSD-3-Clause Group: System/Libraries -Url: http://hackage.haskell.org/package/%{pkg_name} -Source0: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz +Url: https://hackage.haskell.org/package/%{pkg_name} +Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ghc-Cabal-devel @@ -52,9 +52,10 @@ %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other -Provides: %{name}-static = %{version}-%{release} -Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} +Requires(post): ghc-compiler = %{ghc_version} +Requires(postun): ghc-compiler = %{ghc_version} +Requires: %{name} = %{version}-%{release} %description devel This package provides the Haskell %{pkg_name} library development files. ++++++ semigroups-0.15.4.tar.gz -> semigroups-0.16.2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/.travis.yml new/semigroups-0.16.2.2/.travis.yml --- old/semigroups-0.15.4/.travis.yml 2014-10-31 23:28:41.000000000 +0100 +++ new/semigroups-0.16.2.2/.travis.yml 2015-03-07 08:26:45.000000000 +0100 @@ -1,4 +1,58 @@ -language: haskell +# NB: don't set `language: haskell` here + +# See also https://github.com/hvr/multi-ghc-travis for more information +env: + - GHCVER=7.0.4 CABALVER=1.16 + # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's + # no package for earlier cabal versions in the PPA + - GHCVER=7.4.2 CABALVER=1.16 + - GHCVER=7.6.3 CABALVER=1.16 + - GHCVER=7.8.2 CABALVER=1.18 + # NOTE: we can't use Cabal 1.20 yet due to + # https://github.com/haskell/cabal/issues/1806 + - GHCVER=head CABALVER=1.20 + +matrix: + allow_failures: + - env: GHCVER=head CABALVER=1.20 + +# Note: the distinction between `before_install` and `install` is not +# important. +before_install: + - travis_retry sudo add-apt-repository -y ppa:hvr/ghc + - travis_retry sudo apt-get update + - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER + - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH + - cabal --version + +install: + - travis_retry cabal update + - cabal install --only-dependencies + +# Here starts the actual work to be performed for the package under +# test; any command which exits with a non-zero exit code causes the +# build to fail. +script: + # -v2 provides useful information for debugging + - cabal configure -v2 + + # this builds all libraries and executables + # (including tests/benchmarks) + - cabal build + + # tests that a source-distribution can be generated + - cabal sdist + + # check that the generated source-distribution can be built & installed + - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; + cd dist/; + if [ -f "$SRC_TGZ" ]; then + cabal install --force-reinstalls "$SRC_TGZ"; + else + echo "expected '$SRC_TGZ' not found"; + exit 1; + fi + notifications: irc: channels: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/CHANGELOG.markdown new/semigroups-0.16.2.2/CHANGELOG.markdown --- old/semigroups-0.15.4/CHANGELOG.markdown 1970-01-01 01:00:00.000000000 +0100 +++ new/semigroups-0.16.2.2/CHANGELOG.markdown 2015-03-07 08:26:45.000000000 +0100 @@ -0,0 +1,104 @@ +0.16.2.2 +-------- +* Cleaned up imports to remove warnings on GHC 7.10. + +0.16.2.1 +-------- +* Restored the ability to build on GHC < 7.6. (`Generic1` deriving was only added in GHC 7.6) + +0.16.2 +------ +* Added `genericMappend` and supporting `GSemigroup` class for generically deriving Semigroup instances. +* Added `Arg a b` which only compares for equality/order on its first argument, which can be used to compute `argmin` and `argmax`. +* Add `Bifunctor` `Arg` instance to avoid orphans for GHC 7.10+. +* Added missing `Data.Monoid.Generic` module to source control. + +0.16.1 +------ +* Added `Semigroup` instances for various Builder constructions in `text` and `bytestring` where available. +* Added `MonadFix` and `MonadPlus` instances for `NonEmpty`. + +0.16.0.1 +-------- +* Bumped `deepseq` version bound for GHC 7.10 compatibility. + +0.16 +---- +* `times1p` and `timesN` are now reduced to accepting only a `Natural` argument. `Whole` doesn't exist in GHC 7.10's Numeric.Natural, and `nats` version 1 has removed support for the class. + +0.15.4 +------ +* Use `Data.Coerce.coerce` on GHC 7.8+ to reduce the number of eta-expansions in the resulting core. +* Avoid conflict with pending `Foldable.length` in base. + +0.15.3 +------ +* `instance NFData a => NFData (NonEmpty a)` +* Added `NFData` instances for the types in Data.Semigroup + +0.15.2 +------ +* Fixed a Trustworthiness problem for GHC 7.8+ + +0.15.1 +------ +* Nathan van Doorn fixed a number of embarassing bugs in the `Enum` instances. + +0.15 +---- +* `instance IsList NonEmpty` + +0.14 +---- +* Allow for manual removal of dependencies to support advanced sandbox users who explicitly want to avoid compiling certain dependencies + they know they aren't using. + + We will fix bugs caused by any combination of these package flags, but the API of the package should be considered the default build + configuration with all of the package dependency flags enabled. + +* Will now build as full-fledged `Safe` Haskell if you configure with -f-hashable. + +* Added some missing `Generic`/`Generic`/`Hashable` instances + +0.13.0.1 +-------- +* `Generic` support requires `ghc-prim` on GHC 7.4. + +0.13 +---- +* Added instances for 'Generic', 'Foldable', 'Traversable', 'Enum', 'Functor', 'Hashable', 'Applicative', 'Monad' and 'MonadFix' + +0.12.2 +------ +* Vastly widened the dependency bound on `text` and `bytestring`. + +0.12.1 +------- +* Updated to support the new version of `text`. +* Added `transpose`, `sortBy` and `sortWith`. + +0.12 +---- +* Added an instance for `Const r`. +* Added `some1` + +0.11 +---- +* Added the missing instance for `HashSet`. + +0.10 +---- +* Added support for `unordered-containers`, `bytestring` and `text`. + +0.9.2 +----- +* Added a `DefaultSignature` for `(<>)` in terms of `mappend`. + + +0.9.1 +----- +* Added `timesN`. + +0.9 +--- +* Moved `Numeric.Natural` to a separate `nats` package. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/LICENSE new/semigroups-0.16.2.2/LICENSE --- old/semigroups-0.15.4/LICENSE 2014-10-31 23:28:41.000000000 +0100 +++ new/semigroups-0.16.2.2/LICENSE 2015-03-07 08:26:45.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright 2011-2014 Edward Kmett +Copyright 2011-2015 Edward Kmett All rights reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/semigroups.cabal new/semigroups-0.16.2.2/semigroups.cabal --- old/semigroups-0.15.4/semigroups.cabal 2014-10-31 23:28:41.000000000 +0100 +++ new/semigroups-0.16.2.2/semigroups.cabal 2015-03-07 08:26:45.000000000 +0100 @@ -1,6 +1,6 @@ name: semigroups category: Algebra, Data, Data Structures, Math -version: 0.15.4 +version: 0.16.2.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE @@ -9,12 +9,12 @@ stability: provisional homepage: http://github.com/ekmett/semigroups/ bug-reports: http://github.com/ekmett/semigroups/issues -copyright: Copyright (C) 2011-2014 Edward A. Kmett +copyright: Copyright (C) 2011-2015 Edward A. Kmett synopsis: Anything that associates description: In mathematics, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. A semigroup generalizes a monoid in that there might not exist an identity element. It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, thus the name semigroup. build-type: Simple -extra-source-files: .travis.yml README.markdown +extra-source-files: .travis.yml README.markdown CHANGELOG.markdown source-repository head type: git @@ -81,9 +81,13 @@ Data.Semigroup Data.List.NonEmpty + if impl(ghc >= 7.4) + exposed-modules: + Data.Semigroup.Generic + build-depends: base >= 2 && < 5, - nats >= 0.1 && < 1 + nats >= 0.1 && < 2 if impl(ghc >= 7.4 && < 7.5) build-depends: ghc-prim @@ -95,7 +99,7 @@ build-depends: containers >= 0.3 && < 0.6 if flag(deepseq) - build-depends: deepseq >= 1.1 && < 1.4 + build-depends: deepseq >= 1.1 && < 1.5 if flag(text) build-depends: text >= 0.10 && < 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/src/Data/List/NonEmpty.hs new/semigroups-0.16.2.2/src/Data/List/NonEmpty.hs --- old/semigroups-0.15.4/src/Data/List/NonEmpty.hs 2014-10-31 23:28:41.000000000 +0100 +++ new/semigroups-0.16.2.2/src/Data/List/NonEmpty.hs 2015-03-07 08:26:45.000000000 +0100 @@ -21,10 +21,14 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif + +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(x,y,z) 1 +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.List.NonEmpty --- Copyright : (C) 2011-2014 Edward Kmett, +-- Copyright : (C) 2011-2015 Edward Kmett, -- (C) 2010 Tony Morris, Oliver Taylor, Eelis van der Weegen -- License : BSD-style (see the file LICENSE) -- @@ -126,6 +130,11 @@ #endif import Control.Monad +import Control.Monad.Fix + +#if MIN_VERSION_base(4,4,0) +import Control.Monad.Zip (MonadZip(..)) +#endif #ifdef LANGUAGE_DeriveDataTypeable import Data.Data @@ -135,6 +144,8 @@ import Data.Foldable hiding (toList, length) #else import Data.Foldable hiding (toList) +import Data.Monoid (mappend) +import Data.Traversable #endif import qualified Data.Foldable as Foldable @@ -143,9 +154,7 @@ #endif import qualified Data.List as List -import Data.Monoid (mappend) import Data.Ord (comparing) -import Data.Traversable #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as Exts @@ -167,6 +176,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif ) @@ -191,6 +203,17 @@ rnf (x :| xs) = rnf x `seq` rnf xs #endif +instance MonadFix NonEmpty where + mfix f = case fix (f . head) of + ~(x :| _) -> x :| mfix (tail . f) + +#if MIN_VERSION_base(4,4,0) +instance MonadZip NonEmpty where + mzip = zip + mzipWith = zipWith + munzip = unzip +#endif + length :: NonEmpty a -> Int length (_ :| xs) = 1 + Prelude.length xs {-# INLINE length #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/src/Data/Semigroup/Generic.hs new/semigroups-0.16.2.2/src/Data/Semigroup/Generic.hs --- old/semigroups-0.15.4/src/Data/Semigroup/Generic.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/semigroups-0.16.2.2/src/Data/Semigroup/Generic.hs 2015-03-07 08:26:45.000000000 +0100 @@ -0,0 +1,82 @@ +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE Safe #-} +----------------------------------------------------------------------------- +-- | +-- Module : Data.Semigroup.Generic +-- Copyright : (C) 2014-2015 Edward Kmett, Eric Mertens +-- License : BSD-style (see the file LICENSE) +-- +-- Maintainer : Edward Kmett <[email protected]> +-- Stability : provisional +-- Portability : portable +-- +-- This module provides generic deriving tools for monoids and semigroups for +-- product-like structures. +-- +---------------------------------------------------------------------------- +module Data.Semigroup.Generic + ( GSemigroup + , gmappend + , GMonoid + , gmempty + ) where + +import Data.Semigroup +import GHC.Generics + +-- | Generically generate a 'Semigroup' ('<>') operation for any type +-- implementing 'Generic'. This operation will append two values +-- by point-wise appending their component fields. It is only defined +-- for product types. +-- +-- @ +-- 'gmappend' a ('gmappend' b c) = 'gmappend' ('gmappend' a b) c +-- @ +gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a +gmappend x y = to (gmappend' (from x) (from y)) + +class GSemigroup f where + gmappend' :: f p -> f p -> f p + +instance GSemigroup U1 where + gmappend' _ _ = U1 + +instance GSemigroup V1 where + gmappend' x y = x `seq` y `seq` error "GSemigroup.V1: gmappend'" + +instance Semigroup a => GSemigroup (K1 i a) where + gmappend' (K1 x) (K1 y) = K1 (x <> y) + +instance GSemigroup f => GSemigroup (M1 i c f) where + gmappend' (M1 x) (M1 y) = M1 (gmappend' x y) + +instance (GSemigroup f, GSemigroup g) => GSemigroup (f :*: g) where + gmappend' (x1 :*: x2) (y1 :*: y2) = gmappend' x1 y1 :*: gmappend' x2 y2 + +-- | Generically generate a 'Monoid' 'mempty' for any product-like type +-- implementing 'Generic'. +-- +-- It is only defined for product types. +-- +-- @ +-- 'gmappend' 'gmempty' a = a = 'gmappend' a 'gmempty' +-- @ + +gmempty :: (Generic a, GMonoid (Rep a)) => a +gmempty = to gmempty' + +class GSemigroup f => GMonoid f where + gmempty' :: f p + +instance GMonoid U1 where + gmempty' = U1 + +instance (Semigroup a, Monoid a) => GMonoid (K1 i a) where + gmempty' = K1 mempty + +instance GMonoid f => GMonoid (M1 i c f) where + gmempty' = M1 gmempty' + +instance (GMonoid f, GMonoid g) => GMonoid (f :*: g) where + gmempty' = gmempty' :*: gmempty' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/semigroups-0.15.4/src/Data/Semigroup.hs new/semigroups-0.16.2.2/src/Data/Semigroup.hs --- old/semigroups-0.15.4/src/Data/Semigroup.hs 2014-10-31 23:28:41.000000000 +0100 +++ new/semigroups-0.16.2.2/src/Data/Semigroup.hs 2015-03-07 08:26:45.000000000 +0100 @@ -5,7 +5,7 @@ {-# LANGUAGE DeriveDataTypeable #-} #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 #define LANGUAGE_DefaultSignatures {-# LANGUAGE DefaultSignatures #-} #if defined(MIN_VERSION_hashable) || __GLASGOW_HASKELL__ >= 708 @@ -15,21 +15,26 @@ #endif #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704 +#if __GLASGOW_HASKELL__ >= 704 #define LANGUAGE_DeriveGeneric {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE FlexibleContexts #-} #endif - -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708 +#if __GLASGOW_HASKELL__ >= 708 #define USE_COERCE {-# LANGUAGE ScopedTypeVariables #-} #endif +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(x,y,z) 1 +#endif + ----------------------------------------------------------------------------- -- | -- Module : Data.Semigroup --- Copyright : (C) 2011-2014 Edward Kmett +-- Copyright : (C) 2011-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <[email protected]> @@ -74,18 +79,30 @@ -- * Difference lists of a semigroup , diff , cycle1 + -- * ArgMin, ArgMax + , Arg(..) + , ArgMin + , ArgMax ) where import Prelude hiding (foldr1) -import Data.Monoid (Monoid(..),Dual(..),Endo(..),All(..),Any(..),Sum(..),Product(..)) + +#if MIN_VERSION_base(4,8,0) +import Data.Bifunctor +#else +import Data.Monoid (Monoid(..)) +import Data.Foldable +import Data.Traversable +#endif + +import Data.Monoid (Dual(..),Endo(..),All(..),Any(..),Sum(..),Product(..)) + import Control.Applicative import Control.Monad import Control.Monad.Fix import qualified Data.Monoid as Monoid -import Data.Foldable -import Data.Traversable import Data.List.NonEmpty -import Numeric.Natural.Internal +import Numeric.Natural #ifdef MIN_VERSION_deepseq import Control.DeepSeq (NFData(..)) @@ -102,11 +119,22 @@ #ifdef MIN_VERSION_bytestring import Data.ByteString as Strict import Data.ByteString.Lazy as Lazy + +# if MIN_VERSION_bytestring(0,10,2) +import qualified Data.ByteString.Builder as ByteString +# elif MIN_VERSION_bytestring(0,10,0) +import qualified Data.ByteString.Lazy.Builder as ByteString +# endif + +# if MIN_VERSION_bytestring(0,10,4) +import Data.ByteString.Short +# endif #endif #ifdef MIN_VERSION_text import qualified Data.Text as Strict import qualified Data.Text.Lazy as Lazy +import qualified Data.Text.Lazy.Builder as Text #endif #ifdef MIN_VERSION_hashable @@ -170,17 +198,17 @@ -- -- See also 'timesN'. - times1p :: Whole n => n -> a -> a + times1p :: Natural -> a -> a times1p y0 x0 = f x0 (1 Prelude.+ y0) where f x y | even y = f (x <> x) (y `quot` 2) | y == 1 = x - | otherwise = g (x <> x) (unsafePred y `quot` 2) x + | otherwise = g (x <> x) (pred y `quot` 2) x g x y z | even y = g (x <> x) (y `quot` 2) z | y == 1 = x <> z - | otherwise = g (x <> x) (unsafePred y `quot` 2) (x <> z) + | otherwise = g (x <> x) (pred y `quot` 2) (x <> z) {-# INLINE times1p #-} -- | A generalization of 'Data.List.cycle' to an arbitrary 'Semigroup'. @@ -296,6 +324,7 @@ instance Semigroup (NonEmpty a) where (a :| as) <> ~(b :| bs) = a :| (as ++ b : bs) + newtype Min a = Min { getMin :: a } deriving ( Eq, Ord, Show, Read #ifdef LANGUAGE_DeriveDataTypeable @@ -303,6 +332,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif ) @@ -376,6 +408,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif ) @@ -442,6 +477,64 @@ rnf (Max a) = rnf a #endif +-- | 'Arg' isn't itself a 'Semigroup' in its own right, but it can be placed inside 'Min' and 'Max' +-- to compute an arg min or arg max. +data Arg a b = Arg a b deriving + ( Show, Read +#ifdef LANGUAGE_DeriveDataTypeable + , Data, Typeable +#endif +#ifdef LANGUAGE_DeriveGeneric + , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif +#endif + ) + +type ArgMin a b = Min (Arg a b) +type ArgMax a b = Max (Arg a b) + +instance Functor (Arg a) where + fmap f (Arg x a) = Arg x (f a) + +instance Foldable (Arg a) where + foldMap f (Arg _ a) = f a + +instance Traversable (Arg a) where + traverse f (Arg x a) = Arg x <$> f a + +instance Eq a => Eq (Arg a b) where + Arg a _ == Arg b _ = a == b + +instance Ord a => Ord (Arg a b) where + Arg a _ `compare` Arg b _ = compare a b + min x@(Arg a _) y@(Arg b _) + | a <= b = x + | otherwise = y + max x@(Arg a _) y@(Arg b _) + | a >= b = x + | otherwise = y + +#ifdef MIN_VERSION_deepseq +instance (NFData a, NFData b) => NFData (Arg a b) where + rnf (Arg a b) = rnf a `seq` rnf b `seq` () +#endif + +#ifdef MIN_VERSION_hashable +instance (Hashable a, Hashable b) => Hashable (Arg a b) where +#if MIN_VERSION_hashable(1,2,0) + hashWithSalt p (Arg a b) = hashWithSalt p a `hashWithSalt` b +#else + hash (Arg a b) = hashWithSalt (hash a) b +#endif +#endif + +#if MIN_VERSION_base(4,8,0) +instance Bifunctor Arg where + bimap f g (Arg a b) = Arg (f a) (g b) +#endif + -- | Use @'Option' ('First' a)@ to get the behavior of 'Data.Monoid.First' from @Data.Monoid@. newtype First a = First { getFirst :: a } deriving ( Eq, Ord, Show, Read @@ -451,6 +544,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif ) @@ -517,6 +613,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif ) @@ -584,6 +683,16 @@ instance Semigroup Lazy.ByteString where (<>) = mappend + +# if MIN_VERSION_bytestring(0,10,0) +instance Semigroup ByteString.Builder where + (<>) = mappend +# endif + +# if MIN_VERSION_bytestring(0,10,4) +instance Semigroup ShortByteString where + (<>) = mappend +# endif #endif #ifdef MIN_VERSION_text @@ -592,6 +701,9 @@ instance Semigroup Lazy.Text where (<>) = mappend + +instance Semigroup Text.Builder where + (<>) = mappend #endif #ifdef MIN_VERSION_unordered_containers @@ -612,6 +724,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif ) @@ -659,9 +774,9 @@ -- > timesN n a = a <> a <> ... <> a -- using <> (n-1) times -- -- Implemented using 'times1p'. -timesN :: (Whole n, Monoid a) => n -> a -> a +timesN :: Monoid a => Natural -> a -> a timesN n x | n == 0 = mempty - | otherwise = unwrapMonoid . times1p (unsafePred n) . WrapMonoid $ x + | otherwise = unwrapMonoid . times1p (pred n) . WrapMonoid $ x {-# INLINE timesN #-} @@ -677,6 +792,9 @@ #endif #ifdef LANGUAGE_DeriveGeneric , Generic +#if __GLASGOW_HASKELL__ >= 706 + , Generic1 +#endif #endif )
