tagged 0.8.0.1 → 0.8.1
raw patch · 5 files changed
+62/−11 lines, 5 filesdep +ghc-primPVP ok
version bump matches the API change (PVP)
Dependencies added: ghc-prim
API changes (from Hackage documentation)
+ Data.Tagged: instance Constructor C1_0Tagged
+ Data.Tagged: instance Datatype D1Tagged
+ Data.Tagged: instance Generic (Tagged s b)
+ Data.Tagged: instance Generic1 (Tagged s)
+ Data.Tagged: instance Selector S1_0_0Tagged
Files
- CHANGELOG.markdown +5/−0
- README.markdown +1/−1
- old/Data/Proxy.hs +26/−4
- src/Data/Tagged.hs +26/−5
- tagged.cabal +4/−1
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.8.1+-----+* Add `KProxy` to the backwards compatibility `Data.Proxy` module.+* Add a `Generic` instance to `Proxy`.+ 0.8.0.1 ------- * Fix builds on GHC 7.4.
README.markdown view
@@ -1,4 +1,4 @@ tagged ====== -Values carrying an extra [phantom type](http://www.haskell.org/haskellwiki/Phantom_type) tag.+Values carrying an extra [phantom type](https://wiki.haskell.org/Phantom_type) tag.
old/Data/Proxy.hs view
@@ -2,13 +2,15 @@ #ifdef LANGUAGE_DeriveDataTypeable {-# LANGUAGE DeriveDataTypeable #-} #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706+#if __GLASGOW_HASKELL__ >= 706+{-# LANGUAGE KindSignatures #-} {-# LANGUAGE PolyKinds #-} #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707+#if __GLASGOW_HASKELL__ >= 707 {-# LANGUAGE StandaloneDeriving #-} #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE Trustworthy #-} #endif {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -28,6 +30,7 @@ -- * Proxy values Proxy(..) , asProxyTypeOf+ , KProxy(..) ) where import Control.Applicative (Applicative(..))@@ -38,13 +41,19 @@ #ifdef __GLASGOW_HASKELL__ import GHC.Arr (unsafeIndex, unsafeRangeSize) import Data.Data+#if __GLASGOW_HASKELL__ >= 702+import GHC.Generics (Generic) #endif+#endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707+#if __GLASGOW_HASKELL__ >= 707 deriving instance Typeable Proxy #else data Proxy s = Proxy+#if __GLASGOW_HASKELL__ >= 702+ deriving Generic #endif+#endif instance Eq (Proxy s) where _ == _ = True@@ -170,3 +179,16 @@ asProxyTypeOf :: a -> proxy a -> a asProxyTypeOf = const {-# INLINE asProxyTypeOf #-}++-- | A concrete, promotable proxy type, for use at the kind level+-- There are no instances for this because it is intended at the kind level only+data KProxy+#if __GLASGOW_HASKELL__ >= 706+ (t :: *)+#else+ t+#endif+ = KProxy+#if defined(LANGUAGE_DeriveDataTypeable)+ deriving Typeable+#endif
src/Data/Tagged.hs view
@@ -2,12 +2,15 @@ #ifdef LANGUAGE_DeriveDataTypeable {-# LANGUAGE DeriveDataTypeable #-} #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706+#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} #endif-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE DeriveGeneric #-}+#if __GLASGOW_HASKELL__ < 710 {-# LANGUAGE Trustworthy #-} #endif+#endif ---------------------------------------------------------------------------- -- | -- Module : Data.Tagged@@ -38,21 +41,31 @@ , reproxy ) where +#if __GLASGOW_HASKELL__ >= 710+import Control.Applicative (liftA2)+#else import Control.Applicative ((<$>), liftA2, Applicative(..))+import Data.Traversable (Traversable(..))+import Data.Monoid+#endif+import Data.Foldable (Foldable(..)) import Control.Monad (liftM) #if __GLASGOW_HASKELL__ >= 709 import Data.Bifunctor #endif-import Data.Traversable (Traversable(..))-import Data.Foldable (Foldable(..)) #ifdef __GLASGOW_HASKELL__ import Data.Data #endif import Data.Ix (Ix(..))-import Data.Monoid #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707 import Data.Proxy #endif+#if __GLASGOW_HASKELL__ >= 702+import GHC.Generics (Generic)+#if __GLASGOW_HASKELL__ >= 706+import GHC.Generics (Generic1)+#endif+#endif -- | A @'Tagged' s b@ value is a value @b@ with an attached phantom type @s@. -- This can be used in place of the more traditional but less safe idiom of@@ -63,9 +76,17 @@ -- argument, because the newtype is \"free\" newtype Tagged s b = Tagged { unTagged :: b } deriving ( Eq, Ord, Ix, Bounded+#if __GLASGOW_HASKELL__ >= 702+ , Generic+#if __GLASGOW_HASKELL__ >= 706+ , Generic1+#endif+#endif+ #if __GLASGOW_HASKELL__ >= 707 , Typeable #endif+ ) #ifdef __GLASGOW_HASKELL__
tagged.cabal view
@@ -1,5 +1,5 @@ name: tagged-version: 0.8.0.1+version: 0.8.1 license: BSD3 license-file: LICENSE author: Edward A. Kmett@@ -35,6 +35,9 @@ hs-source-dirs: old exposed-modules: Data.Proxy other-modules: Paths_tagged++ if impl(ghc>=7.2 && <7.5)+ build-depends: ghc-prim if impl(ghc>=7.6) exposed-modules: Data.Proxy.TH