tagged 0.8.2 → 0.8.3
raw patch · 5 files changed
+55/−8 lines, 5 files
Files
- .travis.yml +7/−3
- CHANGELOG.markdown +5/−0
- old/Data/Proxy.hs +24/−1
- src/Data/Tagged.hs +18/−3
- tagged.cabal +1/−1
.travis.yml view
@@ -41,9 +41,13 @@ compiler: ": #GHC 7.10.1" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} - - env: CABALVER=1.22 GHCVER=7.10.2 BUILD=cabal- compiler: ": #GHC 7.10.2"- addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=7.10.3 BUILD=cabal+ compiler: ": #GHC 7.10.3"+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}++ - env: CABALVER=1.24 GHCVER=8.0.1 BUILD=cabal+ compiler: ": #GHC 8.0.1"+ addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} - env: BUILD=stack os: osx
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.8.3+-----+* Manual `Generic1` support to work around a bug in GHC 7.6+* Invert the dependency to supply the `Semigroup` instance ourselves when building on GHC 8+ 0.8.2 ------- * `deepseq` support.
old/Data/Proxy.hs view
@@ -11,7 +11,9 @@ #endif #if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE Trustworthy #-}+{-# LANGUAGE TypeFamilies #-} #endif {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------@@ -45,7 +47,7 @@ import GHC.Arr (unsafeIndex, unsafeRangeSize) import Data.Data #if __GLASGOW_HASKELL__ >= 702-import GHC.Generics (Generic)+import GHC.Generics hiding (Fixity(..)) #endif #endif @@ -55,6 +57,27 @@ data Proxy s = Proxy #if __GLASGOW_HASKELL__ >= 702 deriving Generic++-- We have to implement the Generic1 instance manually due to an old+-- bug in GHC 7.6. This is mostly copied from the output of+--+-- deriving instance Generic1 Proxy+--+-- Compiled with -ddump-deriv on a more recent GHC.+instance Generic1 Proxy where+ type Rep1 Proxy = D1 ProxyMetaData (C1 ProxyMetaCons U1)+ from1 Proxy = M1 (M1 U1)+ to1 (M1 (M1 U1)) = Proxy++data ProxyMetaData+data ProxyMetaCons++instance Datatype ProxyMetaData where+ datatypeName _ = "Proxy"+ moduleName _ = "Data.Proxy"++instance Constructor ProxyMetaCons where+ conName _ = "Proxy" #endif #endif
src/Data/Tagged.hs view
@@ -60,9 +60,12 @@ import Data.Data #endif import Data.Ix (Ix(..))-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707+#if __GLASGOW_HASKELL__ < 707 import Data.Proxy #endif+#if __GLASGOW_HASKELL__ >= 800+import Data.Semigroup (Semigroup(..))+#endif #if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #if __GLASGOW_HASKELL__ >= 706@@ -137,9 +140,19 @@ readsPrec d = readParen (d > 10) $ \r -> [(Tagged a, t) | ("Tagged", s) <- lex r, (a, t) <- readsPrec 11 s] +#if __GLASGOW_HASKELL__ >= 800+instance Semigroup a => Semigroup (Tagged s a) where+ Tagged a <> Tagged b = Tagged (a <> b)+ stimes n (Tagged a) = Tagged (stimes n a)++instance (Semigroup a, Monoid a) => Monoid (Tagged s a) where+ mempty = Tagged mempty+ mappend = (<>)+#else instance Monoid a => Monoid (Tagged s a) where mempty = Tagged mempty mappend (Tagged a) (Tagged b) = Tagged (mappend a b)+#endif instance Functor (Tagged s) where fmap f (Tagged x) = Tagged (f x)@@ -162,13 +175,15 @@ {-# INLINE pure #-} Tagged f <*> Tagged x = Tagged (f x) {-# INLINE (<*>) #-}+ _ *> n = n+ {-# INLINE (*>) #-} instance Monad (Tagged s) where- return = Tagged+ return = pure {-# INLINE return #-} Tagged m >>= k = k m {-# INLINE (>>=) #-}- _ >> n = n+ (>>) = (*>) {-# INLINE (>>) #-} instance Foldable (Tagged s) where
tagged.cabal view
@@ -1,5 +1,5 @@ name: tagged-version: 0.8.2+version: 0.8.3 license: BSD3 license-file: LICENSE author: Edward A. Kmett