tagged 0.8.4 → 0.8.5
raw patch · 6 files changed
+147/−11 lines, 6 filesdep +transformersdep +transformers-compatdep ~template-haskell
Dependencies added: transformers, transformers-compat
Dependency ranges changed: template-haskell
Files
- .travis.yml +26/−10
- CHANGELOG.markdown +6/−0
- README.markdown +2/−0
- old/Data/Proxy.hs +32/−0
- src/Data/Tagged.hs +68/−0
- tagged.cabal +13/−1
.travis.yml view
@@ -14,6 +14,14 @@ matrix: include:+ - env: CABALVER=1.16 GHCVER=7.0.4 BUILD=cabal+ compiler: ": #GHC 7.0.4"+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}++ - env: CABALVER=1.16 GHCVER=7.2.2 BUILD=cabal+ compiler: ": #GHC 7.2.2"+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+ - env: CABALVER=1.16 GHCVER=7.4.2 BUILD=cabal compiler: ": #GHC 7.4.2" addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}@@ -26,20 +34,20 @@ compiler: ": #GHC 7.8.4" addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} - - env: BUILD=stack STACK_YAML=stack-7.8.yaml STACK_OPTIONS=--skip-ghc-check- compiler: ": #GHC 7.8.4"- addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+# - env: BUILD=stack STACK_YAML=stack-7.8.yaml STACK_OPTIONS=--skip-ghc-check+# compiler: ": #GHC 7.8.4"+# addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} - - env: BUILD=stack STACK_YAML=stack-7.8.yaml- os: osx+# - env: BUILD=stack STACK_YAML=stack-7.8.yaml+# os: osx - env: CABALVER=1.22 GHCVER=7.10.1 BUILD=cabal 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: BUILD=stack STACK_OPTIONS=--skip-ghc-check- 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: BUILD=stack STACK_OPTIONS=--skip-ghc-check+# 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.3 BUILD=cabal compiler: ": #GHC 7.10.3"@@ -49,9 +57,17 @@ 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+ - env: CABALVER=head GHCVER=head BUILD=cabal+ compiler: ": #GHC head"+ addons: {apt: {packages: [cabal-install-head,ghc-head,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} +# - env: BUILD=stack+# os: osx++ allow_failures:+ - env: CABALVER=1.16 GHCVER=7.0.4 BUILD=cabal+ - env: CABALVER=1.16 GHCVER=7.2.2 BUILD=cabal+ - env: CABALVER=head GHCVER=head BUILD=cabal before_install: - unset CC
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+0.8.5+-----+* Support `Data.Bifoldable`/`Data.Bitraversable` in `base` for GHC 8.1+.+* Backport the `Eq1`, `Ord1`, `Read1`, and `Show1` instances for `Proxy` from `base-4.9`+* Add `Eq1`/`2`, `Ord1`/`2`, `Read1`/`2`, and `Show1`/`2` instances for `Tagged`+ 0.8.4 ----- * Backport the `Alternative`, `MonadPlus`, and `MonadZip` instances for `Proxy` from `base-4.9`
README.markdown view
@@ -1,4 +1,6 @@ tagged ====== +[](https://hackage.haskell.org/package/tagged) [](http://travis-ci.org/ekmett/tagged)+ Values carrying an extra [phantom type](https://wiki.haskell.org/Phantom_type) tag.
old/Data/Proxy.hs view
@@ -43,6 +43,9 @@ #ifdef MIN_VERSION_deepseq import Control.DeepSeq (NFData(..)) #endif+#ifdef MIN_VERSION_transformers+import Data.Functor.Classes (Eq1(..), Ord1(..), Read1(..), Show1(..))+#endif import Data.Traversable (Traversable(..)) import Data.Foldable (Foldable(..)) import Data.Ix (Ix(..))@@ -157,6 +160,35 @@ #ifdef MIN_VERSION_deepseq instance NFData (Proxy s) where rnf Proxy = ()+#endif++#ifdef MIN_VERSION_transformers+# if MIN_VERSION_transformers(0,4,0) && !(MIN_VERSION_transformers(0,5,0))+instance Eq1 Proxy where+ eq1 = (==)++instance Ord1 Proxy where+ compare1 = compare++instance Read1 Proxy where+ readsPrec1 = readsPrec++instance Show1 Proxy where+ showsPrec1 = showsPrec+# else+instance Eq1 Proxy where+ liftEq _ _ _ = True++instance Ord1 Proxy where+ liftCompare _ _ _ = EQ++instance Show1 Proxy where+ liftShowsPrec _ _ _ _ = showString "Proxy"++instance Read1 Proxy where+ liftReadsPrec _ _ d =+ readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ])+# endif #endif instance Functor Proxy where
src/Data/Tagged.hs view
@@ -55,10 +55,21 @@ #ifdef MIN_VERSION_deepseq import Control.DeepSeq (NFData(..)) #endif+#ifdef MIN_VERSION_transformers+import Data.Functor.Classes ( Eq1(..), Ord1(..), Read1(..), Show1(..)+# if !(MIN_VERSION_transformers(0,4,0)) || MIN_VERSION_transformers(0,5,0)+ , Eq2(..), Ord2(..), Read2(..), Show2(..)+# endif+ )+#endif import Control.Monad (liftM) #if __GLASGOW_HASKELL__ >= 709 import Data.Bifunctor #endif+#if __GLASGOW_HASKELL__ >= 801+import Data.Bifoldable (Bifoldable(..))+import Data.Bitraversable (Bitraversable(..))+#endif #ifdef __GLASGOW_HASKELL__ import Data.Data #endif@@ -171,9 +182,66 @@ {-# INLINE bimap #-} #endif +#if __GLASGOW_HASKELL__ >= 801+-- these instances are provided by the bifunctors package for GHC<8.1+instance Bifoldable Tagged where+ bifoldMap _ g (Tagged b) = g b+ {-# INLINE bifoldMap #-}++instance Bitraversable Tagged where+ bitraverse _ g (Tagged b) = Tagged <$> g b+ {-# INLINE bitraverse #-}+#endif+ #ifdef MIN_VERSION_deepseq instance NFData b => NFData (Tagged s b) where rnf (Tagged b) = rnf b+#endif++#ifdef MIN_VERSION_transformers+# if MIN_VERSION_transformers(0,4,0) && !(MIN_VERSION_transformers(0,5,0))+instance Eq1 (Tagged s) where+ eq1 = (==)++instance Ord1 (Tagged s) where+ compare1 = compare++instance Read1 (Tagged s) where+ readsPrec1 = readsPrec++instance Show1 (Tagged s) where+ showsPrec1 = showsPrec+# else+instance Eq1 (Tagged s) where+ liftEq eq (Tagged a) (Tagged b) = eq a b++instance Ord1 (Tagged s) where+ liftCompare cmp (Tagged a) (Tagged b) = cmp a b++instance Read1 (Tagged s) where+ liftReadsPrec rp _ d = readParen (d > 10) $ \r ->+ [(Tagged a, t) | ("Tagged", s) <- lex r, (a, t) <- rp 11 s]++instance Show1 (Tagged s) where+ liftShowsPrec sp _ n (Tagged b) = showParen (n > 10) $+ showString "Tagged " .+ sp 11 b++instance Eq2 Tagged where+ liftEq2 _ eq (Tagged a) (Tagged b) = eq a b++instance Ord2 Tagged where+ liftCompare2 _ cmp (Tagged a) (Tagged b) = cmp a b++instance Read2 Tagged where+ liftReadsPrec2 _ _ rp _ d = readParen (d > 10) $ \r ->+ [(Tagged a, t) | ("Tagged", s) <- lex r, (a, t) <- rp 11 s]++instance Show2 Tagged where+ liftShowsPrec2 _ _ sp _ n (Tagged b) = showParen (n > 10) $+ showString "Tagged " .+ sp 11 b+# endif #endif instance Applicative (Tagged s) where
tagged.cabal view
@@ -1,5 +1,5 @@ name: tagged-version: 0.8.4+version: 0.8.5 license: BSD3 license-file: LICENSE author: Edward A. Kmett@@ -27,6 +27,14 @@ default: True manual: True +flag transformers+ description:+ You can disable the use of the `transformers` and `transformers-compat` packages using `-f-transformers`.+ .+ Disable 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@@ -53,3 +61,7 @@ if flag(deepseq) build-depends: deepseq >= 1.1 && < 1.5++ if flag(transformers)+ build-depends: transformers >= 0.2 && < 0.6,+ transformers-compat >= 0.5 && < 1