semigroups 0.8.2 → 0.8.3
raw patch · 4 files changed
+21/−9 lines, 4 files
Files
- Data/List/NonEmpty.hs +8/−3
- Data/Semigroup.hs +6/−0
- Numeric/Natural/Internal.hs +1/−2
- semigroups.cabal +6/−4
Data/List/NonEmpty.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-}+#ifdef LANGUAGE_DeriveDataTypeable+{-# LANGUAGE DeriveDataTypeable #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Data.List.NonEmpty@@ -41,7 +44,7 @@ , repeat -- :: a -> NonEmpty a , cycle -- :: NonEmpty a -> NonEmpty a , unfold -- :: (a -> (b, Maybe a) -> a -> NonEmpty b- , insert -- :: Foldable f => a -> f a -> NonEmpty a+ , insert -- :: (Foldable f, Ord a) => a -> f a -> NonEmpty a -- * Extracting sublists , take -- :: Int -> NonEmpty a -> [a] , drop -- :: Int -> NonEmpty a -> [a]@@ -94,7 +97,7 @@ import Data.Foldable hiding (toList) import qualified Data.Foldable as Foldable import qualified Data.List as List-import Data.Monoid hiding (Last)+import Data.Monoid (mappend) import Data.Traversable -- import Data.Semigroup hiding (Last) -- import Data.Semigroup.Foldable@@ -134,7 +137,9 @@ instance Functor NonEmpty where fmap f ~(a :| as) = f a :| fmap f as+#if MIN_VERSION_base(4,2,0) b <$ ~(_ :| as) = b :| (b <$ as)+#endif {- instance Extend NonEmpty where@@ -255,7 +260,7 @@ {-# INLINE tails #-} -- | 'insert' an item into a 'NonEmpty'-insert :: Foldable f => Ord a => a -> f a -> NonEmpty a+insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a insert a = fromList . List.insert a . Foldable.toList {-# INLINE insert #-}
Data/Semigroup.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#ifdef LANGUAGE_DeriveDataTypeable+{-# LANGUAGE DeriveDataTypeable #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Semigroup@@ -168,6 +172,7 @@ instance Num a => Semigroup (Product a) where Product a <> Product b = Product (a * b) +#if MIN_VERSION_base(3,0,0) instance Semigroup (Monoid.First a) where Monoid.First Nothing <> b = b a <> _ = a@@ -177,6 +182,7 @@ a <> Monoid.Last Nothing = a _ <> b = b times1p _ a = a+#endif instance Semigroup (NonEmpty a) where (a :| as) <> ~(b :| bs) = a :| (as ++ b : bs)
Numeric/Natural/Internal.hs view
@@ -19,7 +19,6 @@ import Data.Word import Data.Bits-import Text.Read import Data.Ix newtype Natural = Natural { runNatural :: Integer } deriving (Eq,Ord,Ix)@@ -28,7 +27,7 @@ showsPrec d (Natural n) = showsPrec d n instance Read Natural where- readPrec = fmap Natural $ step readPrec+ readsPrec d = map (\(n, s) -> (Natural n, s)) . readsPrec d instance Num Natural where Natural n + Natural m = Natural (n + m)
semigroups.cabal view
@@ -1,8 +1,8 @@ name: semigroups category: Algebra, Data, Data Structures, Math-version: 0.8.2+version: 0.8.3 license: BSD3-cabal-version: >= 1.6+cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -25,8 +25,11 @@ manual: False library+ default-language: Haskell98+ other-extensions: CPP+ if !impl(hugs)- extensions: DeriveDataTypeable+ other-extensions: DeriveDataTypeable cpp-options: -DLANGUAGE_DeriveDataTypeable if flag(base2)@@ -37,7 +40,6 @@ containers >= 0.3 && < 0.5 ghc-options: -Wall- extensions: CPP exposed-modules: Data.Semigroup