semigroups 0.16.0.1 → 0.16.1
raw patch · 4 files changed
+46/−1 lines, 4 files
Files
- CHANGELOG.markdown +5/−0
- semigroups.cabal +1/−1
- src/Data/List/NonEmpty.hs +16/−0
- src/Data/Semigroup.hs +24/−0
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+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.
semigroups.cabal view
@@ -1,6 +1,6 @@ name: semigroups category: Algebra, Data, Data Structures, Math-version: 0.16.0.1+version: 0.16.1 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE
src/Data/List/NonEmpty.hs view
@@ -126,7 +126,12 @@ #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 #endif@@ -189,6 +194,17 @@ #ifdef MIN_VERSION_deepseq instance NFData a => NFData (NonEmpty a) where 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
src/Data/Semigroup.hs view
@@ -102,11 +102,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@@ -584,6 +595,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@@ -591,6 +612,9 @@ (<>) = mappend instance Semigroup Lazy.Text where+ (<>) = mappend++instance Semigroup Text.Builder where (<>) = mappend #endif