Commits

Tony Morris committed 8586f93

Semigroup on containers

  • Participants
  • Parent commits b739d9a

Comments (0)

Files changed (2)

Data/Semigroup.hs

                      ) where
 
 import Data.Monoid
+import Data.Sequence
+import qualified Data.Set as S
+import qualified Data.Map as M
+import qualified Data.IntSet as IS
+import qualified Data.IntMap as IM
 import Control.Monad.Identity
 import Control.Applicative
 
 
 instance Semigroup [a] where
   (.++.) = (++)
+
+instance Semigroup (Seq a) where
+  (.++.) = mappend
+
+instance Ord a => Semigroup (S.Set a) where
+  (.++.) = mappend
+
+instance Ord k => Semigroup (M.Map k v) where
+  (.++.) = mappend
+
+instance Semigroup IS.IntSet where
+  (.++.) = mappend
+
+instance Semigroup (IM.IntMap v) where
+  (.++.) = mappend
+
   Description:       Choose the new, split-up base package.
 
 Library
-  Build-Depends:     base < 5 && >= 3, mtl
+  Build-Depends:     base < 5 && >= 3, mtl, containers
 
   GHC-Options:       -Wall
   Exposed-Modules:   Data.Semigroup