Hello community,

here is the log from the commit of package ghc-semigroups for openSUSE:Factory 
checked in at 2014-11-26 20:55:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-04-02 17:19:23.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-semigroups.new/ghc-semigroups.changes       
2014-11-26 20:55:31.000000000 +0100
@@ -1,0 +2,7 @@
+Thu Nov 13 14:44:19 UTC 2014 - [email protected]
+
+- update to 0.15.4
+* compatibility with Haskell Platform 2014.2.0.0
+* no upstream changelog 
+
+-------------------------------------------------------------------

Old:
----
  semigroups-0.11.tar.gz

New:
----
  semigroups-0.15.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-semigroups.spec ++++++
--- /var/tmp/diff_new_pack.E79NAx/_old  2014-11-26 20:55:32.000000000 +0100
+++ /var/tmp/diff_new_pack.E79NAx/_new  2014-11-26 20:55:32.000000000 +0100
@@ -19,7 +19,7 @@
 %global pkg_name semigroups
 
 Name:           ghc-semigroups
-Version:        0.11
+Version:        0.15.4
 Release:        0
 Summary:        Anything that associates
 License:        BSD-2-Clause
@@ -34,6 +34,7 @@
 # Begin cabal-rpm deps:
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-containers-devel
+BuildRequires:  ghc-deepseq-devel
 BuildRequires:  ghc-hashable-devel
 BuildRequires:  ghc-nats-devel
 BuildRequires:  ghc-text-devel

++++++ semigroups-0.11.tar.gz -> semigroups-0.15.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/semigroups-0.11/LICENSE new/semigroups-0.15.4/LICENSE
--- old/semigroups-0.11/LICENSE 2013-09-17 16:51:22.000000000 +0200
+++ new/semigroups-0.15.4/LICENSE       2014-10-31 23:28:41.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright 2011-2013 Edward Kmett
+Copyright 2011-2014 Edward Kmett
 
 All rights reserved.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/semigroups-0.11/README.markdown 
new/semigroups-0.15.4/README.markdown
--- old/semigroups-0.11/README.markdown 2013-09-17 16:51:22.000000000 +0200
+++ new/semigroups-0.15.4/README.markdown       2014-10-31 23:28:41.000000000 
+0100
@@ -3,8 +3,9 @@
 
 [![Build 
Status](https://secure.travis-ci.org/ekmett/semigroups.png?branch=master)](http://travis-ci.org/ekmett/semigroups)
 
+Haskellers are usually familiar with monoids. A monoid has an appending 
operation `<>` or `mappend` and an identity element `mempty`. A Semigroup has 
an append `<>`, but does not require an `mempty` element. A Monoid can be made 
a Semigroup with just `instance Semigroup MyMonoid`
 
-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.
+More formally, 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.
 
 Semigroups appear all over the place, except in the Haskell Prelude, so they 
are packaged here.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/semigroups-0.11/semigroups.cabal 
new/semigroups-0.15.4/semigroups.cabal
--- old/semigroups-0.11/semigroups.cabal        2013-09-17 16:51:22.000000000 
+0200
+++ new/semigroups-0.15.4/semigroups.cabal      2014-10-31 23:28:41.000000000 
+0100
@@ -1,6 +1,6 @@
 name:          semigroups
 category:      Algebra, Data, Data Structures, Math
-version:       0.11
+version:       0.15.4
 license:       BSD3
 cabal-version: >= 1.10
 license-file:  LICENSE
@@ -9,7 +9,7 @@
 stability:     provisional
 homepage:      http://github.com/ekmett/semigroups/
 bug-reports:   http://github.com/ekmett/semigroups/issues
-copyright:     Copyright (C) 2011-2013 Edward A. Kmett
+copyright:     Copyright (C) 2011-2014 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.
@@ -20,34 +20,88 @@
   type: git
   location: git://github.com/ekmett/semigroups.git
 
-flag base2
-  default: False
-  manual: False
+flag hashable
+  description:
+    You can disable the use of the `hashable` package using `-f-hashable`.
+    .
+    Disabling this is an unsupported configuration, but it may be useful for 
accelerating builds in sandboxes for expert users.
+    .
+    If disabled we will not supply instances of `Hashable`
+    .
+    Note: `-f-hashable` implies `-f-unordered-containers`, as we are 
necessarily not able to supply those instances as well.
+  default: True
+  manual: True
+
+flag bytestring
+  description:
+    You can disable the use of the `bytestring` package using `-f-bytestring`.
+    .
+    Disabling this is an unsupported configuration, but it may be useful for 
accelerating builds in sandboxes for expert users.
+  default: True
+  manual: True
+
+flag containers
+  description:
+    You can disable the use of the `containers` package using `-f-containers`.
+    .
+    Disabing this is an unsupported configuration, but it may be useful for 
accelerating builds in sandboxes for expert users.
+  default: True
+  manual: True
+
+flag deepseq
+  description:
+    You can disable the use of the `deepseq` package using `-f-deepseq`.
+    .
+    Disabing this is an unsupported configuration, but it may be useful for 
accelerating builds in sandboxes for expert users.
+  default: True
+  manual: True
+
+flag text
+  description:
+    You can disable the use of the `text` package using `-f-text`.
+    .
+    Disabling this is an unsupported configuration, but it may be useful for 
accelerating builds in sandboxes for expert users.
+  default: True
+  manual: True
+
+flag unordered-containers
+  description:
+    You can disable the use of the `unordered-containers` package using 
`-f-unordered-containers`.
+    .
+    Disabling this is an unsupported configuration, but it may be useful for 
accelerating builds in sandboxes for expert users.
+  default: True
+  manual: True
 
 library
   default-language: Haskell98
-  other-extensions: CPP
-
-  if !impl(hugs)
-    other-extensions: DeriveDataTypeable
-    cpp-options: -DLANGUAGE_DeriveDataTypeable
-
-  if flag(base2)
-    build-depends: base == 2.*
-    cpp-options: -DBASE2
-  else
-    build-depends:
-      base                 >= 3    && < 5,
-      bytestring           >= 0.9  && < 0.11,
-      containers           >= 0.3  && < 0.6,
-      hashable             >= 1.1  && < 1.3,
-      nats                 >= 0.1  && < 1,
-      text                 >= 0.10 && < 0.12,
-      unordered-containers >= 0.2  && < 0.3
-
   hs-source-dirs: src
-  ghc-options:    -Wall
+  ghc-options: -Wall
 
   exposed-modules:
     Data.Semigroup
     Data.List.NonEmpty
+
+  build-depends:
+    base >= 2   && < 5,
+    nats >= 0.1 && < 1
+
+  if impl(ghc >= 7.4 && < 7.5)
+    build-depends: ghc-prim
+
+  if flag(bytestring)
+    build-depends: bytestring >= 0.9 && < 1
+
+  if flag(containers)
+    build-depends: containers >= 0.3 && < 0.6
+
+  if flag(deepseq)
+    build-depends: deepseq >= 1.1 && < 1.4
+
+  if flag(text)
+    build-depends: text >= 0.10 && < 2
+
+  if flag(hashable)
+    build-depends: hashable >= 1.1  && < 1.3
+
+  if flag(hashable) && flag(unordered-containers)
+    build-depends: unordered-containers >= 0.2  && < 0.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/semigroups-0.11/src/Data/List/NonEmpty.hs 
new/semigroups-0.15.4/src/Data/List/NonEmpty.hs
--- old/semigroups-0.11/src/Data/List/NonEmpty.hs       2013-09-17 
16:51:22.000000000 +0200
+++ new/semigroups-0.15.4/src/Data/List/NonEmpty.hs     2014-10-31 
23:28:41.000000000 +0100
@@ -1,11 +1,30 @@
 {-# LANGUAGE CPP #-}
-#ifdef LANGUAGE_DeriveDataTypeable
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702
+#if defined(MIN_VERSION_hashable) || __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE Trustworthy #-}
+#else
+{-# LANGUAGE Safe #-}
+#endif
+#endif
+
+#ifdef __GLASGOW_HASKELL__
+#define LANGUAGE_DeriveDataTypeable
 {-# LANGUAGE DeriveDataTypeable #-}
 #endif
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704
+#define LANGUAGE_DeriveGeneric
+{-# LANGUAGE DeriveGeneric #-}
+#endif
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE TypeFamilies #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.List.NonEmpty
--- Copyright   :  (C) 2011-2013 Edward Kmett,
+-- Copyright   :  (C) 2011-2014 Edward Kmett,
 --                (C) 2010 Tony Morris, Oliver Taylor, Eelis van der Weegen
 -- License     :  BSD-style (see the file LICENSE)
 --
@@ -27,7 +46,9 @@
    , scanr       -- :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b
    , scanl1      -- :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
    , scanr1      -- :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
-   -- , transpose   -- :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)
+   , transpose   -- :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)
+   , sortBy      -- :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a
+   , sortOn      -- :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a
    -- * Basic functions
    , length      -- :: NonEmpty a -> Int
    , head        -- :: NonEmpty a -> a
@@ -47,6 +68,7 @@
    , cycle       -- :: NonEmpty a -> NonEmpty a
    , unfold      -- :: (a -> (b, Maybe a) -> a -> NonEmpty b
    , insert      -- :: (Foldable f, Ord a) => a -> f a -> NonEmpty a
+   , some1       -- :: Alternative f => f a -> f (NonEmpty a)
    -- * Extracting sublists
    , take        -- :: Int -> NonEmpty a -> [a]
    , drop        -- :: Int -> NonEmpty a -> [a]
@@ -97,22 +119,43 @@
   , length
   )
 
-
 import Control.Applicative
--- import Control.Comonad
+
+#ifdef MIN_VERSION_deepseq
+import Control.DeepSeq (NFData(..))
+#endif
+
 import Control.Monad
--- import Data.Functor.Alt
+
+#ifdef LANGUAGE_DeriveDataTypeable
+import Data.Data
+#endif
+
+#if MIN_VERSION_base(4,8,0)
+import Data.Foldable hiding (toList, length)
+#else
 import Data.Foldable hiding (toList)
+#endif
 import qualified Data.Foldable as Foldable
+
+#ifdef MIN_VERSION_hashable
+import Data.Hashable
+#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
+#endif
 -- import Data.Semigroup hiding (Last)
 -- import Data.Semigroup.Foldable
 -- import Data.Semigroup.Traversable
 
-#ifdef LANGUAGE_DeriveDataTypeable
-import Data.Data
+#ifdef LANGUAGE_DeriveGeneric
+import GHC.Generics
 #endif
 
 infixr 5 :|, <|
@@ -122,8 +165,32 @@
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data, Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (NonEmpty a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (a :| as) = p `hashWithSalt` a `hashWithSalt` as
+#else
+  hash (a :| as) = hash a `combine` hash as
+#endif
+#endif
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708
+instance Exts.IsList (NonEmpty a) where
+  type Item (NonEmpty a) = a
+  fromList = fromList
+  toList = toList
+#endif
+
+#ifdef MIN_VERSION_deepseq
+instance NFData a => NFData (NonEmpty a) where
+  rnf (x :| xs) = rnf x `seq` rnf xs
+#endif
+
 length :: NonEmpty a -> Int
 length (_ :| xs) = 1 + Prelude.length xs
 {-# INLINE length #-}
@@ -168,22 +235,6 @@
   b <$ ~(_ :| as)   = b   :| (b <$ as)
 #endif
 
-{-
-instance Extend NonEmpty where
-  extend f w@ ~(_ :| aas) = f w :| case aas of
-      []     -> []
-      (a:as) -> toList (extend f (a :| as))
-
-instance Comonad NonEmpty where
-  extract ~(a :| _) = a
-
-instance Apply NonEmpty where
-  (<.>) = ap
-
-instance Alt NonEmpty where
-  (a :| as) <!> ~(b :| bs) = a :| (as ++ b : bs)
--}
-
 instance Applicative NonEmpty where
   pure a = a :| []
   (<*>) = ap
@@ -197,12 +248,6 @@
 instance Traversable NonEmpty where
   traverse f ~(a :| as) = (:|) <$> f a <*> traverse f as
 
-{-
-instance Traversable1 NonEmpty where
-  traverse1 f (a :| []) = (:|[]) <$> f a
-  traverse1 f (a :| (b: bs)) = (\a' (b':| bs') -> a' :| b': bs') <$> f a <.> 
traverse1 f (b :| bs)
--}
-
 instance Foldable NonEmpty where
   foldr f z ~(a :| as) = f a (foldr f z as)
   foldl f z ~(a :| as) = foldl f (f z a) as
@@ -210,15 +255,6 @@
   foldMap f ~(a :| as) = f a `mappend` foldMap f as
   fold ~(m :| ms) = m `mappend` fold ms
 
-{-
-instance Foldable1 NonEmpty where
-  foldMap1 f (a :| []) = f a
-  foldMap1 f (a :| b : bs) = f a <> foldMap1 f (b :| bs)
-
-instance Semigroup (NonEmpty a) where
-  (<>) = (<!>)
--}
-
 -- | Extract the first element of the stream.
 head :: NonEmpty a -> a
 head ~(a :| _) = a
@@ -299,6 +335,11 @@
 insert a = fromList . List.insert a . Foldable.toList
 {-# INLINE insert #-}
 
+-- | @'some1' x@ sequences @x@ one or more times.
+some1 :: Alternative f => f a -> f (NonEmpty a)
+some1 x = (:|) <$> x <*> many x
+{-# INLINE some1 #-}
+
 -- | 'scanl' is similar to 'foldl', but returns a stream of successive
 -- reduced values from the left:
 --
@@ -538,3 +579,20 @@
 nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a
 nubBy eq (a :| as) = a :| List.nubBy eq (List.filter (\b -> not (eq a b)) as)
 
+-- | 'transpose' for 'NonEmpty', behaves the same as 'Data.List.transpose'
+-- The rows/columns need not be the same length, in which case
+-- > transpose . transpose /= id
+transpose :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)
+transpose = fmap fromList
+          . fromList . List.transpose . Foldable.toList
+          . fmap Foldable.toList
+
+-- | 'sortBy' for 'NonEmpty', behaves the same as 'Data.List.sortBy'
+sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a
+sortBy f = lift (List.sortBy f)
+
+-- | 'sortOn' for 'NonEmpty', behaves the same as:
+--
+-- > sortBy . comparing
+sortOn :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a
+sortOn = sortBy . comparing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/semigroups-0.11/src/Data/Semigroup.hs 
new/semigroups-0.15.4/src/Data/Semigroup.hs
--- old/semigroups-0.11/src/Data/Semigroup.hs   2013-09-17 16:51:22.000000000 
+0200
+++ new/semigroups-0.15.4/src/Data/Semigroup.hs 2014-10-31 23:28:41.000000000 
+0100
@@ -1,15 +1,35 @@
 {-# LANGUAGE CPP #-}
-#ifdef LANGUAGE_DeriveDataTypeable
+
+#ifdef __GLASGOW_HASKELL__
+#define LANGUAGE_DeriveDataTypeable
 {-# LANGUAGE DeriveDataTypeable #-}
 #endif
+
 #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702
+#define LANGUAGE_DefaultSignatures
 {-# LANGUAGE DefaultSignatures #-}
+#if defined(MIN_VERSION_hashable) || __GLASGOW_HASKELL__ >= 708
 {-# LANGUAGE Trustworthy #-}
+#else
+{-# LANGUAGE Safe #-}
+#endif
+#endif
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704
+#define LANGUAGE_DeriveGeneric
+{-# LANGUAGE DeriveGeneric #-}
 #endif
+
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708
+#define USE_COERCE
+{-# LANGUAGE ScopedTypeVariables #-}
+#endif
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.Semigroup
--- Copyright   :  (C) 2011-2013 Edward Kmett,
+-- Copyright   :  (C) 2011-2014 Edward Kmett
 -- License     :  BSD-style (see the file LICENSE)
 --
 -- Maintainer  :  Edward Kmett <[email protected]>
@@ -57,7 +77,7 @@
   ) where
 
 import Prelude hiding (foldr1)
-import Data.Monoid 
(Monoid(..),Dual(..),Endo(..),All(..),Any(..),Sum(..),Product(..),Endo(..))
+import Data.Monoid 
(Monoid(..),Dual(..),Endo(..),All(..),Any(..),Sum(..),Product(..))
 import Control.Applicative
 import Control.Monad
 import Control.Monad.Fix
@@ -65,20 +85,35 @@
 import Data.Foldable
 import Data.Traversable
 import Data.List.NonEmpty
-
 import Numeric.Natural.Internal
+
+#ifdef MIN_VERSION_deepseq
+import Control.DeepSeq (NFData(..))
+#endif
+
+#ifdef MIN_VERSION_containers
 import Data.Sequence (Seq, (><))
 import Data.Set (Set)
 import Data.IntSet (IntSet)
 import Data.Map (Map)
 import Data.IntMap (IntMap)
+#endif
 
-#ifndef BASE2
+#ifdef MIN_VERSION_bytestring
 import Data.ByteString as Strict
 import Data.ByteString.Lazy as Lazy
-import Data.Text as Strict
-import Data.Text.Lazy as Lazy
+#endif
+
+#ifdef MIN_VERSION_text
+import qualified Data.Text as Strict
+import qualified Data.Text.Lazy as Lazy
+#endif
+
+#ifdef MIN_VERSION_hashable
 import Data.Hashable
+#endif
+
+#ifdef MIN_VERSION_unordered_containers
 import Data.HashMap.Lazy as Lazy
 import Data.HashSet
 #endif
@@ -87,18 +122,30 @@
 import Data.Data
 #endif
 
+#ifdef LANGUAGE_DeriveGeneric
+import GHC.Generics
+#endif
+
+#ifdef USE_COERCE
+import Data.Coerce
+#endif
+
 infixr 6 <>
 
 class Semigroup a where
   -- | An associative operation.
   --
-  -- > (a <> b) <> c = a <> (b <> c)
+  -- @
+  -- (a '<>' b) '<>' c = a '<>' (b '<>' c)
+  -- @
   --
   -- If @a@ is also a 'Monoid' we further require
   --
-  -- > (<>) = mappend
+  -- @
+  -- ('<>') = 'mappend'
+  -- @
   (<>) :: a -> a -> a
-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702
+#ifdef LANGUAGE_DefaultSignatures
   default (<>) :: Monoid a => a -> a -> a
   (<>) = mappend
 #endif
@@ -114,12 +161,14 @@
 
   -- | Repeat a value (n + 1) times.
   --
-  -- > times1p n a = a <> a <> ... <> a  -- using <> n times
+  -- @
+  -- 'times1p' n a = a '<>' a '<>' ... '<>' a  -- using '<>' n times
+  -- @
   --
   -- The default definition uses peasant multiplication, exploiting 
associativity to only
   -- require /O(log n)/ uses of @\<\>@.
   --
-  -- See also 'times'.
+  -- See also 'timesN'.
 
   times1p :: Whole n => n -> a -> a
   times1p y0 x0 = f x0 (1 Prelude.+ y0)
@@ -189,21 +238,48 @@
   times1p n (Dual a) = Dual (times1p n a)
 
 instance Semigroup (Endo a) where
+#ifdef USE_COERCE
+  (<>) = coerce ((.) :: (a -> a) -> (a -> a) -> (a -> a))
+#else
   Endo f <> Endo g = Endo (f . g)
+#endif
 
 instance Semigroup All where
+#ifdef USE_COERCE
+  (<>) = coerce (&&)
+#else
   All a <> All b = All (a && b)
+#endif
   times1p _ a = a
 
 instance Semigroup Any where
+#ifdef USE_COERCE
+  (<>) = coerce (||)
+#else
   Any a <> Any b = Any (a || b)
+#endif
   times1p _ a = a
 
 instance Num a => Semigroup (Sum a) where
+#ifdef USE_COERCE
+  (<>) = coerce ((+) :: a -> a -> a)
+#else
   Sum a <> Sum b = Sum (a + b)
+#endif
 
 instance Num a => Semigroup (Product a) where
+#ifdef USE_COERCE
+  (<>) = coerce ((*) :: a -> a -> a)
+#else
   Product a <> Product b = Product (a * b)
+#endif
+
+instance Semigroup a => Semigroup (Const a b) where
+#ifdef USE_COERCE
+  (<>) = coerce ((<>) :: a -> a -> a)
+#else
+  Const a <> Const b = Const (a <> b)
+#endif
 
 #if MIN_VERSION_base(3,0,0)
 instance Semigroup (Monoid.First a) where
@@ -221,75 +297,304 @@
   (a :| as) <> ~(b :| bs) = a :| (as ++ b : bs)
 
 newtype Min a = Min { getMin :: a } deriving
-  ( Eq, Ord, Bounded, Show, Read
+  ( Eq, Ord, Show, Read
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data, Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+instance Bounded a => Bounded (Min a) where
+  minBound = Min minBound
+  maxBound = Min maxBound
+
+instance Enum a => Enum (Min a) where
+  succ (Min a) = Min (succ a)
+  pred (Min a) = Min (pred a)
+  toEnum = Min . toEnum
+  fromEnum = fromEnum . getMin
+  enumFrom (Min a) = Min <$> enumFrom a
+  enumFromThen (Min a) (Min b) = Min <$> enumFromThen a b
+  enumFromTo (Min a) (Min b) = Min <$> enumFromTo a b
+  enumFromThenTo (Min a) (Min b) (Min c) = Min <$> enumFromThenTo a b c
+
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (Min a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (Min a) = hashWithSalt p a
+#else
+  hash (Min a) = hash a
+#endif
+#endif
+
 instance Ord a => Semigroup (Min a) where
+#ifdef USE_COERCE
+  (<>) = coerce (min :: a -> a -> a)
+#else
   Min a <> Min b = Min (a `min` b)
+#endif
   times1p _ a = a
 
 instance (Ord a, Bounded a) => Monoid (Min a) where
   mempty = maxBound
   mappend = (<>)
 
+instance Functor Min where
+  fmap f (Min x) = Min (f x)
+
+instance Foldable Min where
+  foldMap f (Min a) = f a
+
+instance Traversable Min where
+  traverse f (Min a) = Min <$> f a
+
+instance Applicative Min where
+  pure = Min
+  a <* _ = a
+  _ *> a = a
+  Min f <*> Min x = Min (f x)
+
+instance Monad Min where
+  return = Min
+  _ >> a = a
+  Min a >>= f = f a
+
+instance MonadFix Min where
+  mfix f = fix (f . getMin)
+
+#ifdef MIN_VERSION_deepseq
+instance NFData a => NFData (Min a) where
+  rnf (Min a) = rnf a
+#endif
+
 newtype Max a = Max { getMax :: a } deriving
-  ( Eq, Ord, Bounded, Show, Read
+  ( Eq, Ord, Show, Read
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data, Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+instance Bounded a => Bounded (Max a) where
+  minBound = Max minBound
+  maxBound = Max maxBound
+
+instance Enum a => Enum (Max a) where
+  succ (Max a) = Max (succ a)
+  pred (Max a) = Max (pred a)
+  toEnum = Max . toEnum
+  fromEnum = fromEnum . getMax
+  enumFrom (Max a) = Max <$> enumFrom a
+  enumFromThen (Max a) (Max b) = Max <$> enumFromThen a b
+  enumFromTo (Max a) (Max b) = Max <$> enumFromTo a b
+  enumFromThenTo (Max a) (Max b) (Max c) = Max <$> enumFromThenTo a b c
+
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (Max a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (Max a) = hashWithSalt p a
+#else
+  hash (Max a) = hash a
+#endif
+#endif
+
 instance Ord a => Semigroup (Max a) where
+#ifdef USE_COERCE
+  (<>) = coerce (max :: a -> a -> a)
+#else
   Max a <> Max b = Max (a `max` b)
+#endif
   times1p _ a = a
 
 instance (Ord a, Bounded a) => Monoid (Max a) where
   mempty = minBound
   mappend = (<>)
 
+instance Functor Max where
+  fmap f (Max x) = Max (f x)
+
+instance Foldable Max where
+  foldMap f (Max a) = f a
+
+instance Traversable Max where
+  traverse f (Max a) = Max <$> f a
+
+instance Applicative Max where
+  pure = Max
+  a <* _ = a
+  _ *> a = a
+  Max f <*> Max x = Max (f x)
+
+instance Monad Max where
+  return = Max
+  _ >> a = a
+  Max a >>= f = f a
+
+instance MonadFix Max where
+  mfix f = fix (f . getMax)
+
+#ifdef MIN_VERSION_deepseq
+instance NFData a => NFData (Max a) where
+  rnf (Max a) = rnf a
+#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, Bounded, Show, Read
+  ( Eq, Ord, Show, Read
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data
   , Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+instance Bounded a => Bounded (First a) where
+  minBound = First minBound
+  maxBound = First maxBound
+
+instance Enum a => Enum (First a) where
+  succ (First a) = First (succ a)
+  pred (First a) = First (pred a)
+  toEnum = First . toEnum
+  fromEnum = fromEnum . getFirst
+  enumFrom (First a) = First <$> enumFrom a
+  enumFromThen (First a) (First b) = First <$> enumFromThen a b
+  enumFromTo (First a) (First b) = First <$> enumFromTo a b
+  enumFromThenTo (First a) (First b) (First c) = First <$> enumFromThenTo a b c
+
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (First a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (First a) = hashWithSalt p a
+#else
+  hash (First a) = hash a
+#endif
+#endif
+
 instance Semigroup (First a) where
   a <> _ = a
   times1p _ a = a
 
+instance Functor First where
+  fmap f (First x) = First (f x)
+
+instance Foldable First where
+  foldMap f (First a) = f a
+
+instance Traversable First where
+  traverse f (First a) = First <$> f a
+
+instance Applicative First where
+  pure x = First x
+  a <* _ = a
+  _ *> a = a
+  First f <*> First x = First (f x)
+
+instance Monad First where
+  return = First
+  _ >> a = a
+  First a >>= f = f a
+
+instance MonadFix First where
+  mfix f = fix (f . getFirst)
+
+#ifdef MIN_VERSION_deepseq
+instance NFData a => NFData (First a) where
+  rnf (First a) = rnf a
+#endif
+
 -- | Use @'Option' ('Last' a)@ to get the behavior of 'Data.Monoid.Last' from 
@Data.Monoid@
 newtype Last a = Last { getLast :: a } deriving
-  ( Eq, Ord, Bounded, Show, Read
+  ( Eq, Ord, Show, Read
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data, Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+instance Bounded a => Bounded (Last a) where
+  minBound = Last minBound
+  maxBound = Last maxBound
+
+instance Enum a => Enum (Last a) where
+  succ (Last a) = Last (succ a)
+  pred (Last a) = Last (pred a)
+  toEnum = Last . toEnum
+  fromEnum = fromEnum . getLast
+  enumFrom (Last a) = Last <$> enumFrom a
+  enumFromThen (Last a) (Last b) = Last <$> enumFromThen a b
+  enumFromTo (Last a) (Last b) = Last <$> enumFromTo a b
+  enumFromThenTo (Last a) (Last b) (Last c) = Last <$> enumFromThenTo a b c
+
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (Last a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (Last a) = hashWithSalt p a
+#else
+  hash (Last a) = hash a
+#endif
+#endif
+
 instance Semigroup (Last a) where
   _ <> b = b
   times1p _ a = a
 
+instance Functor Last where
+  fmap f (Last x) = Last (f x)
+  a <$ _ = Last a
+
+instance Foldable Last where
+  foldMap f (Last a) = f a
+
+instance Traversable Last where
+  traverse f (Last a) = Last <$> f a
+
+instance Applicative Last where
+  pure = Last
+  a <* _ = a
+  _ *> a = a
+  Last f <*> Last x = Last (f x)
+
+instance Monad Last where
+  return = Last
+  _ >> a = a
+  Last a >>= f = f a
+
+instance MonadFix Last where
+  mfix f = fix (f . getLast)
+
+#ifdef MIN_VERSION_deepseq
+instance NFData a => NFData (Last a) where
+  rnf (Last a) = rnf a
+#endif
+
 -- (==)/XNOR on Bool forms a 'Semigroup', but has no good name
 
-#ifndef BASE2
+#ifdef MIN_VERSION_bytestring
 instance Semigroup Strict.ByteString where
   (<>) = mappend
 
 instance Semigroup Lazy.ByteString where
   (<>) = mappend
+#endif
 
+#ifdef MIN_VERSION_text
 instance Semigroup Strict.Text where
   (<>) = mappend
 
 instance Semigroup Lazy.Text where
   (<>) = mappend
+#endif
 
+#ifdef MIN_VERSION_unordered_containers
 instance (Hashable k, Eq k) => Semigroup (Lazy.HashMap k a) where
   (<>) = mappend
 
@@ -301,22 +606,57 @@
 -- | Provide a Semigroup for an arbitrary Monoid.
 newtype WrappedMonoid m = WrapMonoid
   { unwrapMonoid :: m } deriving
-  ( Eq, Ord, Bounded, Show, Read
+  ( Eq, Ord, Show, Read
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data, Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (WrappedMonoid a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (WrapMonoid a) = hashWithSalt p a
+#else
+  hash (WrapMonoid a) = hash a
+#endif
+#endif
+
 instance Monoid m => Semigroup (WrappedMonoid m) where
+#ifdef USE_COERCE
+  (<>) = coerce (mappend :: m -> m -> m)
+#else
   WrapMonoid a <> WrapMonoid b = WrapMonoid (a `mappend` b)
+#endif
 
 instance Monoid m => Monoid (WrappedMonoid m) where
   mempty = WrapMonoid mempty
-  WrapMonoid a `mappend` WrapMonoid b = WrapMonoid (a `mappend` b)
+  mappend = (<>)
+
+instance Bounded a => Bounded (WrappedMonoid a) where
+  minBound = WrapMonoid minBound
+  maxBound = WrapMonoid maxBound
+
+instance Enum a => Enum (WrappedMonoid a) where
+  succ (WrapMonoid a) = WrapMonoid (succ a)
+  pred (WrapMonoid a) = WrapMonoid (pred a)
+  toEnum = WrapMonoid . toEnum
+  fromEnum = fromEnum . unwrapMonoid
+  enumFrom (WrapMonoid a) = WrapMonoid <$> enumFrom a
+  enumFromThen (WrapMonoid a) (WrapMonoid b) = WrapMonoid <$> enumFromThen a b
+  enumFromTo (WrapMonoid a) (WrapMonoid b) = WrapMonoid <$> enumFromTo a b
+  enumFromThenTo (WrapMonoid a) (WrapMonoid b) (WrapMonoid c) = WrapMonoid <$> 
enumFromThenTo a b c
+
+#ifdef MIN_VERSION_deepseq
+instance NFData m => NFData (WrappedMonoid m) where
+  rnf (WrapMonoid a) = rnf a
+#endif
 
 -- | Repeat a value @n@ times.
 --
--- > times n a = a <> a <> ... <> a  -- using <> (n-1) times
+-- > timesN n a = a <> a <> ... <> a  -- using <> (n-1) times
 --
 -- Implemented using 'times1p'.
 timesN :: (Whole n, Monoid a) => n -> a -> a
@@ -325,16 +665,30 @@
 {-# INLINE timesN #-}
 
 
--- | Option is effectively 'Maybe' with a better instance of 'Monoid', built 
off of an underlying 'Semigroup'
--- instead of an underlying 'Monoid'. Ideally, this type would not exist at 
all and we would just fix the 'Monoid' intance of 'Maybe'
+-- | 'Option' is effectively 'Maybe' with a better instance of 'Monoid', built 
off of an underlying 'Semigroup'
+-- instead of an underlying 'Monoid'.
+--
+-- Ideally, this type would not exist at all and we would just fix the 
'Monoid' instance of 'Maybe'
 newtype Option a = Option
   { getOption :: Maybe a } deriving
   ( Eq, Ord, Show, Read
 #ifdef LANGUAGE_DeriveDataTypeable
   , Data, Typeable
 #endif
+#ifdef LANGUAGE_DeriveGeneric
+  , Generic
+#endif
   )
 
+#ifdef MIN_VERSION_hashable
+instance Hashable a => Hashable (Option a) where
+#if MIN_VERSION_hashable(1,2,0)
+  hashWithSalt p (Option a) = hashWithSalt p a
+#else
+  hash (Option a) = hash a
+#endif
+#endif
+
 instance Functor Option where
   fmap f (Option a) = Option (fmap f a)
 
@@ -371,21 +725,31 @@
   traverse f (Option (Just a)) = Option . Just <$> f a
   traverse _ (Option Nothing)  = pure (Option Nothing)
 
+#ifdef MIN_VERSION_deepseq
+instance NFData a => NFData (Option a) where
+  rnf (Option a) = rnf a
+#endif
+
 -- | Fold an 'Option' case-wise, just like 'maybe'.
 option :: b -> (a -> b) -> Option a -> b
 option n j (Option m) = maybe n j m
 
 instance Semigroup a => Semigroup (Option a) where
+#ifdef USE_COERCE
+  (<>) = coerce ((<>) :: Maybe a -> Maybe a -> Maybe a)
+#else
   Option a <> Option b = Option (a <> b)
+#endif
 
 instance Semigroup a => Monoid (Option a) where
   mempty = Option Nothing
-  Option a `mappend` Option b = Option (a <> b)
+  mappend = (<>)
 
--- | This lets you use a difference list of a Semigroup as a Monoid.
+-- | This lets you use a difference list of a 'Semigroup' as a 'Monoid'.
 diff :: Semigroup m => m -> Endo m
 diff = Endo . (<>)
 
+#ifdef MIN_VERSION_containers
 instance Semigroup (Seq a) where
   (<>) = (><)
 
@@ -404,3 +768,4 @@
 instance Ord k => Semigroup (Map k v) where
   (<>) = mappend
   times1p _ a = a
+#endif

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to