tagged 0.8.10 → 0.9
raw patch · 4 files changed
Files
- CHANGELOG.markdown +11/−0
- src/Data/Proxy/TH.hs +0/−90
- src/Data/Tagged.hs +1/−11
- tagged.cabal +4/−16
CHANGELOG.markdown view
@@ -1,3 +1,14 @@+0.9 [2026.09.28]+----------------+* Remove `Data.Proxy.TH`, as its functionality has been subsumed+ by using `Proxy` with `TypeApplications` syntax. This completes the+ deprecation cycle that was introduced in `tagged-0.8.10`.++0.8.11 [2026.09.28]+-------------------+* Include `Data` and `Generic` instances for `Tagged` when building with+ MicroHs.+ 0.8.10 [2025.12.07] ------------------- * Deprecate `Data.Proxy.TH.{pr,pr1}`, as their functionality has been subsumed
− src/Data/Proxy/TH.hs
@@ -1,90 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE TemplateHaskellQuotes #-}-#ifndef MIN_VERSION_template_haskell-#define MIN_VERSION_template_haskell(x,y,z) 1-#endif--- template-haskell is only safe since GHC-8.2-#if __GLASGOW_HASKELL__ >= 802-{-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif-module Data.Proxy.TH- ( pr- , pr1- ) where--import Data.Char-import Data.Proxy (Proxy(..))-import Language.Haskell.TH-import Language.Haskell.TH.Quote--proxy_d, proxy_tc :: Name-proxy_d = 'Proxy-proxy_tc = ''Proxy--proxyTypeQ :: TypeQ -> TypeQ-proxyTypeQ t = appT (conT proxy_tc) t--proxyExpQ :: TypeQ -> ExpQ-proxyExpQ t = sigE (conE proxy_d) (proxyTypeQ t)--proxyPatQ :: TypeQ -> PatQ-proxyPatQ t = sigP (conP proxy_d []) (proxyTypeQ t)---- | A proxy value quasiquoter. @[pr|T|]@ will splice an expression--- @Proxy::Proxy T@, while @[pr|A,B,C|]@ will splice in a value of--- @Proxy :: Proxy [A,B,C]@.---- TODO: parse a richer syntax for the types involved here so we can include spaces, applications, etc.-{-# DEPRECATED- pr- [ "'pr' will be removed in the next release. Use 'Proxy' with @TypeApplications@ instead. "- , "Instead of using @[pr|T|]@, use @Proxy \\@T@ instead. "- , "Instead of using @[pr|A,B,C|]@, use @Proxy \\@[A,B,C]@ instead. "- ] #-}-pr :: QuasiQuoter-pr = QuasiQuoter (mkProxy proxyExpQ) (mkProxy proxyPatQ) (mkProxy proxyTypeQ) undefined where- mkProxy :: (TypeQ -> r) -> String -> r- mkProxy p s = case ts of- [h@(t:_)]- | isUpper t -> p $ conT $ mkName h- | otherwise -> p $ varT $ mkName h- _ -> p $ mkList <$> cons- where- ts = map strip $ splitOn ',' s- cons = mapM (conT . mkName) ts- mkList = foldr (AppT . AppT PromotedConsT) PromotedNilT---- | Like 'pr', but takes a single type, which is used to produce a--- 'Proxy' for a single-element list containing only that type. This--- is useful for passing a single type to a function that wants a list--- of types.---- TODO: parse a richer syntax for the types involved here so we can include spaces, applications, etc.-{-# DEPRECATED- pr1- [ "'pr1' will be removed in the next release. Use 'Proxy' with @TypeApplications@ instead. "- , "Instead of using @[pr1|T|]@, use @Proxy \\@'[T]@ instead. "- ] #-}-pr1 :: QuasiQuoter-pr1 = QuasiQuoter (mkProxy proxyExpQ) (mkProxy proxyPatQ) (mkProxy proxyTypeQ) undefined where- sing x = AppT (AppT PromotedConsT x) PromotedNilT- mkProxy p s = case s of- t:_- | isUpper t -> p (fmap sing (conT $ mkName s))- | otherwise -> p (fmap sing (varT $ mkName s))- _ -> error "Empty string passed to pr1"---- | Split on a delimiter.-splitOn :: Eq a => a -> [a] -> [[a]]-splitOn d = go where- go [] = []- go xs = case t of- [] -> [h]- (_:t') -> h : go t'- where (h,t) = break (== d) xs---- | Remove white space from both ends of a 'String'.-strip :: String -> String-strip = takeWhile (not . isSpace) . dropWhile isSpace
src/Data/Tagged.hs view
@@ -55,9 +55,7 @@ import Data.Foldable1 (Foldable1(..)) import Data.Bifoldable1 (Bifoldable1(..)) #endif-#ifdef __GLASGOW_HASKELL__ import Data.Data-#endif import Data.Ix (Ix(..)) import Data.Semigroup (Semigroup(..)) import Data.String (IsString(..))@@ -66,9 +64,7 @@ #endif import Foreign.Ptr (castPtr) import Foreign.Storable (Storable(..))-#ifdef __GLASGOW_HASKELL__ import GHC.Generics (Generic, Generic1)-#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@@ -81,13 +77,8 @@ -- 'Tagged' has kind @k -> * -> *@ if the compiler supports @PolyKinds@, therefore -- there is an extra @k@ showing in the instance haddocks that may cause confusion. newtype Tagged s b = Tagged { unTagged :: b }- deriving ( Eq, Ord, Ix, Bounded-#ifdef __GLASGOW_HASKELL__- , Generic, Generic1-#endif- )+ deriving (Eq, Ord, Ix, Bounded, Generic, Generic1) -#ifdef __GLASGOW_HASKELL__ instance (Data s, Data b) => Data (Tagged s b) where gfoldl f z (Tagged b) = z Tagged `f` b toConstr _ = taggedConstr@@ -105,7 +96,6 @@ taggedDataType :: DataType taggedDataType = mkDataType "Data.Tagged.Tagged" [taggedConstr] {-# INLINE taggedDataType #-}-#endif instance Show b => Show (Tagged s b) where showsPrec n (Tagged b) = showParen (n > 10) $
tagged.cabal view
@@ -1,5 +1,5 @@ name: tagged-version: 0.8.10+version: 0.9 license: BSD3 license-file: LICENSE author: Edward A. Kmett@@ -26,8 +26,9 @@ GHC == 9.4.8 GHC == 9.6.6 GHC == 9.8.4- GHC == 9.10.1- GHC == 9.12.1+ GHC == 9.10.3+ GHC == 9.12.2+ GHC == 9.14.1 source-repository head type: git@@ -41,14 +42,6 @@ default: True manual: True -flag template-haskell- description:- You can disable the use of the `template-haskell` package using `-f-template-haskell`.- .- Disabling 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@@ -66,8 +59,3 @@ if flag(deepseq) build-depends: deepseq >= 1.1 && < 1.6-- if flag(template-haskell) && impl(ghc)- build-depends: template-haskell >= 2.11 && < 2.24- exposed-modules:- Data.Proxy.TH