text-show-instances 3.8.2 → 3.8.3
raw patch · 12 files changed
+191/−208 lines, 12 filesdep ~QuickCheckdep ~basedep ~bifunctorsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, base, bifunctors, ghc-boot-th, haskeline, random, template-haskell, th-orphans, time
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- src/TextShow/Data/Bifunctor.hs +27/−16
- src/TextShow/Language/Haskell/TH.hs +67/−138
- src/TextShow/System/Time.hs +2/−2
- src/TextShow/System/Win32.hs +3/−3
- src/TextShow/Trace/Hpc.hs +11/−11
- tests/Instances/GHC/LanguageExtensions/Type.hs +1/−3
- tests/Instances/System/Console/Terminfo.hs +3/−3
- tests/Instances/System/Directory.hs +1/−1
- tests/Instances/Trace/Hpc.hs +7/−7
- tests/Spec/Data/BifunctorSpec.hs +61/−21
- text-show-instances.cabal +3/−3
CHANGELOG.md view
@@ -1,3 +1,8 @@+### 3.8.3 [2019.11.08]+* Make the `TextShow1` and `TextShow2` instances for `Fix` and `Join` in+ `TextShow.Data.Bifunctor` match the behavior the corresponding `Show1` and+ `Show2` instances in `bifunctors`.+ ### 3.8.2 [2019.09.03] * Make the test suite compile on GHC 8.8.1.
src/TextShow/Data/Bifunctor.hs view
@@ -34,17 +34,23 @@ import Data.Bifunctor.Tannen (Tannen) import Data.Bifunctor.Wrapped (WrappedBifunctor) -import TextShow (TextShow(..), TextShow1(..), TextShow2(..))+import GHC.Show (appPrec)++import Prelude ()+import Prelude.Compat++import TextShow (TextShow(..), TextShow1(..), TextShow2(..),+ fromString, showbParen, singleton) import TextShow.TH (deriveTextShow2, makeShowbPrec, makeLiftShowbPrec) -- | /Since: 2/+$(deriveTextShow2 ''Biff)+-- | /Since: 2/ instance TextShow (p (f a) (g b)) => TextShow (Biff p f g a b) where showbPrec = $(makeShowbPrec ''Biff) -- | /Since: 2/ instance (TextShow2 p, TextShow1 f, TextShow1 g, TextShow a) => TextShow1 (Biff p f g a) where liftShowbPrec = liftShowbPrec2 showbPrec showbList--- | /Since: 2/-$(deriveTextShow2 ''Biff) -- | /Since: 2/ instance TextShow (f a) => TextShow (Clown f a b) where@@ -60,24 +66,29 @@ showbPrec = $(makeShowbPrec ''Fix) -- | /Since: 2/ instance TextShow2 p => TextShow1 (Fix p) where- liftShowbPrec sp sl p =- liftShowbPrec2 (liftShowbPrec sp sl) (liftShowbList sp sl) sp sl p . out+ liftShowbPrec sp sl p (In x) = showbParen (p > appPrec) $+ fromString "In {out = "+ <> liftShowbPrec2 (liftShowbPrec sp sl) (liftShowbList sp sl) sp sl 0 x+ <> singleton '}' -- | /Since: 2/+$(deriveTextShow2 ''Flip)+-- | /Since: 2/ instance TextShow (p b a) => TextShow (Flip p a b) where showbPrec = $(makeShowbPrec ''Flip) -- | /Since: 2/ instance (TextShow2 p, TextShow a) => TextShow1 (Flip p a) where liftShowbPrec = liftShowbPrec2 showbPrec showbList--- | /Since: 2/-$(deriveTextShow2 ''Flip) -- | /Since: 2/ instance TextShow (p a a) => TextShow (Join p a) where showbPrec = $(makeShowbPrec ''Join) -- | /Since: 2/ instance TextShow2 p => TextShow1 (Join p) where- liftShowbPrec sp sl p = liftShowbPrec2 sp sl sp sl p . runJoin+ liftShowbPrec sp sl p (Join x) = showbParen (p > appPrec) $+ fromString "Join {runJoin = "+ <> liftShowbPrec2 sp sl sp sl 0 x+ <> singleton '}' -- | /Since: 2/ instance TextShow (g b) => TextShow (Joker g a b) where@@ -89,37 +100,37 @@ $(deriveTextShow2 ''Joker) -- | /Since: 2/+$(deriveTextShow2 ''Product)+-- | /Since: 2/ instance (TextShow (f a b), TextShow (g a b)) => TextShow (Product f g a b) where showbPrec = $(makeShowbPrec ''Product) -- | /Since: 2/ instance (TextShow2 f, TextShow2 g, TextShow a) => TextShow1 (Product f g a) where liftShowbPrec = liftShowbPrec2 showbPrec showbList--- | /Since: 2/-$(deriveTextShow2 ''Product) -- | /Since: 2/+$(deriveTextShow2 ''Sum)+-- | /Since: 2/ instance (TextShow (f a b), TextShow (g a b)) => TextShow (Sum f g a b) where showbPrec = $(makeShowbPrec ''Sum) -- | /Since: 2/ instance (TextShow2 f, TextShow2 g, TextShow a) => TextShow1 (Sum f g a) where liftShowbPrec = liftShowbPrec2 showbPrec showbList--- | /Since: 2/-$(deriveTextShow2 ''Sum) -- | /Since: 2/+$(deriveTextShow2 ''Tannen)+-- | /Since: 2/ instance TextShow (f (p a b)) => TextShow (Tannen f p a b) where showbPrec = $(makeShowbPrec ''Tannen) -- | /Since: 2/ instance (TextShow1 f, TextShow2 p, TextShow a) => TextShow1 (Tannen f p a) where liftShowbPrec = liftShowbPrec2 showbPrec showbList--- | /Since: 2/-$(deriveTextShow2 ''Tannen) -- | /Since: 2/+$(deriveTextShow2 ''WrappedBifunctor)+-- | /Since: 2/ instance TextShow (p a b) => TextShow (WrappedBifunctor p a b) where showbPrec = $(makeShowbPrec ''WrappedBifunctor) -- | /Since: 2/ instance (TextShow2 p, TextShow a) => TextShow1 (WrappedBifunctor p a) where liftShowbPrec = liftShowbPrec2 showbPrec showbList--- | /Since: 2/-$(deriveTextShow2 ''WrappedBifunctor)
src/TextShow/Language/Haskell/TH.hs view
@@ -100,157 +100,86 @@ else False -- | /Since: 2/-$(deriveTextShow ''AnnLookup)--- | /Since: 2/-$(deriveTextShow ''AnnTarget)--- | /Since: 2/-$(deriveTextShow ''Body)--- | /Since: 2/-$(deriveTextShow ''Callconv)--- | /Since: 2/-$(deriveTextShow ''Clause)--- | /Since: 2/-$(deriveTextShow ''Con)--- | /Since: 2/-$(deriveTextShow ''Dec)--- | /Since: 2/-$(deriveTextShow ''Exp)-#if !(MIN_VERSION_template_haskell(2,13,0))--- | /Since: 2/-$(deriveTextShow ''FamFlavour)-#endif--- | /Since: 2/-$(deriveTextShow ''Fixity)--- | /Since: 2/-$(deriveTextShow ''FixityDirection)--- | /Since: 2/-$(deriveTextShow ''Foreign)--- | /Since: 2/-$(deriveTextShow ''FunDep)--- | /Since: 2/-$(deriveTextShow ''Guard)--- | /Since: 2/-$(deriveTextShow ''Info)--- | /Since: 2/-$(deriveTextShow ''Inline)--- | /Since: 2/-$(deriveTextShow ''Lit)--- | /Since: 2/-$(deriveTextShow ''Loc)--- | /Since: 2/-$(deriveTextShow ''Match)--- | /Since: 2/-$(deriveTextShow ''ModName)--- | /Since: 2/-$(deriveTextShow ''Module)--- | /Since: 2/-$(deriveTextShow ''ModuleInfo)---- | /Since: 2/ instance TextShow Name where showb = showbName --- | /Since: 3.3/-$(deriveTextShow ''NameFlavour)--- | /Since: 3.3/-$(deriveTextShow ''NameSpace) -- | /Since: 2/-$(deriveTextShow ''OccName)--- | /Since: 2/-$(deriveTextShow ''Pat)--- | /Since: 2/-$(deriveTextShow ''Phases)--- | /Since: 2/-$(deriveTextShow ''PkgName)--- | /Since: 2/-$(deriveTextShow ''Pragma)--- | /Since: 2/-$(deriveTextShow ''Range)--- | /Since: 2/-$(deriveTextShow ''Role)--- | /Since: 2/-$(deriveTextShow ''RuleBndr)--- | /Since: 2/-$(deriveTextShow ''RuleMatch)--- | /Since: 2/-$(deriveTextShow ''Safety)--- | /Since: 2/-$(deriveTextShow ''Stmt)--- | /Since: 2/-$(deriveTextShow ''TyLit)--- | /Since: 2/-$(deriveTextShow ''Type)--- | /Since: 2/-$(deriveTextShow ''TySynEqn)--- | /Since: 2/-$(deriveTextShow ''TyVarBndr)---- | /Since: 2/ instance TextShow Doc where showb = renderB . to_HPJ_Doc +-- A significant chunk of these data types are mutually recursive, which makes+-- it impossible to derive TextShow instances for everything individually using+-- Template Haskell. As a workaround, we splice everything together in a single+-- ungodly large splice. One unfortunate consequence of this is that we cannot+-- give Haddocks to each instance :(+$(concat <$> traverse deriveTextShow+ [ ''AnnLookup+ , ''AnnTarget+ , ''Body+ , ''Callconv+ , ''Clause+ , ''Con+ , ''Dec+ , ''Exp+#if !(MIN_VERSION_template_haskell(2,13,0))+ , ''FamFlavour+#endif+ , ''Fixity+ , ''FixityDirection+ , ''Foreign+ , ''FunDep+ , ''Guard+ , ''Info+ , ''Inline+ , ''Lit+ , ''Loc+ , ''Match+ , ''ModName+ , ''Module+ , ''ModuleInfo+ , ''NameFlavour+ , ''NameSpace+ , ''OccName+ , ''Pat+ , ''Phases+ , ''PkgName+ , ''Pragma+ , ''Range+ , ''Role+ , ''RuleBndr+ , ''RuleMatch+ , ''Safety+ , ''Stmt+ , ''TyLit+ , ''Type+ , ''TySynEqn+ , ''TyVarBndr+ #if !(MIN_VERSION_template_haskell(2,10,0))--- | Only available with @template-haskell-2.10@ or earlier.------ /Since: 2/-$(deriveTextShow ''Pred)+ , ''Pred #endif #if MIN_VERSION_template_haskell(2,11,0)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''Bang)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''DecidedStrictness)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''FamilyResultSig)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''InjectivityAnn)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''Overlap)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''SourceStrictness)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''SourceUnpackedness)--- | Only available with @template-haskell-2.11.0.0@ or later.------ /Since: 3/-$(deriveTextShow ''TypeFamilyHead)+ , ''Bang+ , ''DecidedStrictness+ , ''FamilyResultSig+ , ''InjectivityAnn+ , ''Overlap+ , ''SourceStrictness+ , ''SourceUnpackedness+ , ''TypeFamilyHead #else--- | Only available with @template-haskell-2.11@ or earlier.------ /Since: 3/-$(deriveTextShow ''Strict)+ , ''Strict #endif #if MIN_VERSION_template_haskell(2,12,0)--- | Only available with @template-haskell-2.12.0.0@ or later.------ /Since: 3.6/-$(deriveTextShow ''DerivClause)--- | Only available with @template-haskell-2.12.0.0@ or later.------ /Since: 3.6/-$(deriveTextShow ''DerivStrategy)--- | Only available with @template-haskell-2.12.0.0@ or later.------ /Since: 3.3/-$(deriveTextShow ''PatSynArgs)--- | Only available with @template-haskell-2.12.0.0@ or later.------ /Since: 3.3/-$(deriveTextShow ''PatSynDir)+ , ''DerivClause+ , ''DerivStrategy+ , ''PatSynArgs+ , ''PatSynDir #endif++#if MIN_VERSION_template_haskell(2,16,0)+ , ''Bytes+#endif+ ])
src/TextShow/System/Time.hs view
@@ -28,8 +28,8 @@ -- | /Since: 2/ $(deriveTextShow ''TimeDiff) -- | /Since: 2/-$(deriveTextShow ''CalendarTime)--- | /Since: 2/ $(deriveTextShow ''Month) -- | /Since: 2/ $(deriveTextShow ''Day)+-- | /Since: 2/+$(deriveTextShow ''CalendarTime)
src/TextShow/System/Win32.hs view
@@ -45,9 +45,11 @@ import TextShow.TH (deriveTextShow) -- | /Since: 2/+$(deriveTextShow ''Exception)+-- | /Since: 2/ $(deriveTextShow ''DebugEventInfo) -- | /Since: 2/-$(deriveTextShow ''Exception)+$(deriveTextShow ''FILETIME) -- | /Since: 2/ $(deriveTextShow ''BY_HANDLE_FILE_INFORMATION) -- | /Since: 2/@@ -56,8 +58,6 @@ $(deriveTextShow ''ProcessorArchitecture) -- | /Since: 2/ $(deriveTextShow ''SYSTEM_INFO)--- | /Since: 2/-$(deriveTextShow ''FILETIME) -- | /Since: 2/ $(deriveTextShow ''SYSTEMTIME) -- | /Since: 2/
src/TextShow/Trace/Hpc.hs view
@@ -26,17 +26,6 @@ import Trace.Hpc.Util (HpcPos, Hash, fromHpcPos) -- | /Since: 2/-$(deriveTextShow ''Mix)--- | /Since: 2/-$(deriveTextShow ''BoxLabel)--- | /Since: 2/-$(deriveTextShow ''CondBox)--- | /Since: 2/-$(deriveTextShow ''Tix)--- | /Since: 2/-$(deriveTextShow ''TixModule)---- | /Since: 2/ instance TextShow HpcPos where showb hp = case fromHpcPos hp of (l1, c1, l2, c2) -> showb l1@@ -49,3 +38,14 @@ instance TextShow Hash where showb = showb . FromStringShow {-# INLINE showb #-}++-- | /Since: 2/+$(deriveTextShow ''TixModule)+-- | /Since: 2/+$(deriveTextShow ''CondBox)+-- | /Since: 2/+$(deriveTextShow ''BoxLabel)+-- | /Since: 2/+$(deriveTextShow ''Mix)+-- | /Since: 2/+$(deriveTextShow ''Tix)
tests/Instances/GHC/LanguageExtensions/Type.hs view
@@ -19,11 +19,9 @@ #if defined(MIN_VERSION_ghc_boot_th) import GHC.LanguageExtensions.Type (Extension(..))+import Language.Haskell.TH.Instances () import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum) -# if !(MIN_VERSION_ghc_boot_th(8,8,1))-deriving instance Bounded Extension-# endif instance Arbitrary Extension where arbitrary = arbitraryBoundedEnum #endif
tests/Instances/System/Console/Terminfo.hs view
@@ -29,12 +29,12 @@ import System.Console.Terminfo (Color, SetupTermError) import Test.QuickCheck (Arbitrary(..)) +$(Generics.deriveAll0 ''Color)+$(Generics.deriveAll0 ''SetupTermError)+ instance Arbitrary Color where arbitrary = genericArbitrary instance Arbitrary SetupTermError where arbitrary = genericArbitrary--$(Generics.deriveAll0 ''Color)-$(Generics.deriveAll0 ''SetupTermError) #endif
tests/Instances/System/Directory.hs view
@@ -29,9 +29,9 @@ import Test.QuickCheck (arbitraryBoundedEnum) #endif +$(Generics.deriveAll0 ''Permissions) instance Arbitrary Permissions where arbitrary = genericArbitrary-$(Generics.deriveAll0 ''Permissions) #if MIN_VERSION_directory(1,2,3) instance Arbitrary XdgDirectory where
tests/Instances/Trace/Hpc.hs view
@@ -35,6 +35,12 @@ import Trace.Hpc.Tix (Tix(..), TixModule(..)) import Trace.Hpc.Util (HpcPos, Hash, toHpcPos) +$(Generics.deriveAll0 ''BoxLabel)+$(Generics.deriveAll0 ''Tix)+$(Generics.deriveAll0 ''TixModule)+$(Generics.deriveAll0 ''HpcPos)+$(Generics.deriveAll0 ''Hash)+ instance Arbitrary Mix where arbitrary = Mix <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <@> [fMixEntry]@@ -62,14 +68,8 @@ arbitrary = genericArbitrary ---------------------------------------------------------------------------------- Workarounds to make Arbitrary instances faster+-- Workaround to make Arbitrary instances faster ------------------------------------------------------------------------------- fMixEntry :: MixEntry fMixEntry = (toHpcPos (0, 1, 2, 3), ExpBox True)--$(Generics.deriveAll0 ''BoxLabel)-$(Generics.deriveAll0 ''Tix)-$(Generics.deriveAll0 ''TixModule)-$(Generics.deriveAll0 ''HpcPos)-$(Generics.deriveAll0 ''Hash)
tests/Spec/Data/BifunctorSpec.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {-| Module: Spec.Data.BifunctorSpec Copyright: (C) 2014-2017 Ryan Scott@@ -24,7 +26,7 @@ import Instances.Data.Bifunctor () -import Spec.Utils (matchesTextShowSpec)+import Spec.Utils import Test.Hspec (Spec, describe, hspec, parallel) @@ -35,23 +37,61 @@ spec :: Spec spec = parallel $ do- describe "Biff Either [] Maybe Char Int" $- matchesTextShowSpec (Proxy :: Proxy (Biff Either [] Maybe Char Int))- describe "Clown [] Char Int" $- matchesTextShowSpec (Proxy :: Proxy (Clown [] Char Int))- describe "Fix Either Int" $- matchesTextShowSpec (Proxy :: Proxy (Fix Either Int))- describe "Flip Either Int Char" $- matchesTextShowSpec (Proxy :: Proxy (Flip Either Int Char))- describe "Join Either Int" $- matchesTextShowSpec (Proxy :: Proxy (Join Either Int))- describe "Joker [] Char Int" $- matchesTextShowSpec (Proxy :: Proxy (Joker [] Char Int))- describe "Product Either ((,,) Bool) Int Char" $- matchesTextShowSpec (Proxy :: Proxy (Product Either ((,,) Bool) Int Char))- describe "Sum Either ((,,) Bool) Int Char" $- matchesTextShowSpec (Proxy :: Proxy (Sum Either ((,,) Bool) Int Char))- describe "Tannen Maybe Either Int Char" $- matchesTextShowSpec (Proxy :: Proxy (Tannen Maybe Either Int Char))- describe "WrappedBifunctor Either Int Char" $- matchesTextShowSpec (Proxy :: Proxy (WrappedBifunctor Either Int Char))+ describe "Biff Either [] Maybe Char Int" $ do+ matchesTextShowSpec (Proxy :: Proxy (Biff Either [] Maybe Char Int))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Biff Either [] Maybe Char Int))+ matchesTextShow2Spec (Proxy :: Proxy (Biff Either [] Maybe Char Int))+#endif+ describe "Clown [] Char Int" $ do+ matchesTextShowSpec (Proxy :: Proxy (Clown [] Char Int))+ matchesTextShow1Spec (Proxy :: Proxy (Clown [] Char Int))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow2Spec (Proxy :: Proxy (Clown [] Char Int))+#endif+ describe "Fix Either Int" $ do+ matchesTextShowSpec (Proxy :: Proxy (Fix Either Int))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Fix Either Int))+#endif+ describe "Flip Either Int Char" $ do+ matchesTextShowSpec (Proxy :: Proxy (Flip Either Int Char))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Flip Either Int Char))+ matchesTextShow2Spec (Proxy :: Proxy (Flip Either Int Char))+#endif+ describe "Join Either Int" $ do+ matchesTextShowSpec (Proxy :: Proxy (Join Either Int))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Join Either Int))+#endif+ describe "Joker [] Char Int" $ do+ matchesTextShowSpec (Proxy :: Proxy (Joker [] Char Int))+ matchesTextShow1Spec (Proxy :: Proxy (Joker [] Char Int))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow2Spec (Proxy :: Proxy (Joker [] Char Int))+#endif+ describe "Product Either ((,,) Bool) Int Char" $ do+ matchesTextShowSpec (Proxy :: Proxy (Product Either (,) Int Char))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Product Either (,) Int Char))+ matchesTextShow2Spec (Proxy :: Proxy (Product Either (,) Int Char))+#endif+ describe "Sum Either ((,,) Bool) Int Char" $ do+ matchesTextShowSpec (Proxy :: Proxy (Sum Either (,) Int Char))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Sum Either (,) Int Char))+ matchesTextShow2Spec (Proxy :: Proxy (Sum Either (,) Int Char))+#endif+ describe "Tannen Maybe Either Int Char" $ do+ matchesTextShowSpec (Proxy :: Proxy (Tannen Maybe Either Int Char))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (Tannen Maybe Either Int Char))+ matchesTextShow2Spec (Proxy :: Proxy (Tannen Maybe Either Int Char))+#endif+ describe "WrappedBifunctor Either Int Char" $ do+ matchesTextShowSpec (Proxy :: Proxy (WrappedBifunctor Either Int Char))+#if defined(NEW_FUNCTOR_CLASSES)+ matchesTextShow1Spec (Proxy :: Proxy (WrappedBifunctor Either Int Char))+ matchesTextShow2Spec (Proxy :: Proxy (WrappedBifunctor Either Int Char))+#endif
text-show-instances.cabal view
@@ -1,5 +1,5 @@ name: text-show-instances-version: 3.8.2+version: 3.8.3 synopsis: Additional instances for text-show description: @text-show-instances@ is a supplemental library to @text-show@ that provides additional @Show@ instances for data types in@@ -254,7 +254,7 @@ Spec.System.Console.TerminfoSpec Spec.System.PosixSpec build-depends: base-compat-batteries >= 0.10 && < 1- , bifunctors >= 5.2 && < 6+ , bifunctors >= 5.5.5 && < 6 , binary >= 0.7.1 && < 0.9 , containers >= 0.5.5 && < 0.7 , directory >= 1.2.1 && < 1.4@@ -273,7 +273,7 @@ , text-short >= 0.1 && < 0.2 , text-show >= 3.4 && < 4 , text-show-instances- , th-orphans >= 0.13.3 && < 1+ , th-orphans >= 0.13.8 && < 1 , time >= 0.1 && < 1.10 , unordered-containers >= 0.2 && < 0.3 , vector >= 0.9 && < 0.13