packages feed

text-show 3.7.3 → 3.7.4

raw patch · 18 files changed

+371/−151 lines, 18 filesdep ~QuickCheckdep ~basedep ~containers

Dependency ranges changed: QuickCheck, base, containers, ghc-boot-th, semigroups, tagged, template-haskell, transformers

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+### 3.7.4 [2018.07.03]+* Add `FromGeneric` and `FromGeneric1` newtype adapters to `TextShow.Generic`.+  These are suitable for use with `DerivingVia`, and provide a convenient way+  to obtain `Generic(1)`-based defaults for `TextShow(1)` instances.+* Add `TextShow(1)` instances for `Data.Monoid.Ap` on `base-4.12` or later.+* Make `showbEFloat`'s behavior match that of `showEFloat` in `base-4.12`.+ ### 3.7.3 [2018.04.07] * Use `base-compat-batteries`. * Add a `TextShow FixIOException` instance on `base-4.11` or later.
README.md view
@@ -3,7 +3,8 @@ [![Hackage Dependencies](https://img.shields.io/hackage-deps/v/text-show.svg)](http://packdeps.haskellers.com/reverse/text-show) [![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org] [![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)][tl;dr Legal: BSD3]-[![Build](https://img.shields.io/travis/RyanGlScott/text-show.svg)](https://travis-ci.org/RyanGlScott/text-show)+[![Linux build](https://img.shields.io/travis/RyanGlScott/text-show.svg)](https://travis-ci.org/RyanGlScott/text-show)+[![Windows build](https://ci.appveyor.com/api/projects/status/fy1q86lbfttmnthy?svg=true)](https://ci.appveyor.com/project/RyanGlScott/text-show)  [Hackage: text-show]:   http://hackage.haskell.org/package/text-show
src/TextShow/Classes.hs view
@@ -59,7 +59,7 @@ -- If you do not want to create 'TextShow' instances manually, you can alternatively -- use the "TextShow.TH" module to automatically generate default 'TextShow' -- instances using Template Haskell, or the "TextShow.Generic" module to--- quickly define 'TextShow' instances using 'genericShowbPrec'.+-- quickly define 'TextShow' instances using "GHC.Generics". -- -- /Since: 2/ class TextShow a where
src/TextShow/Control/Exception.hs view
@@ -1,6 +1,10 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}+{-# LANGUAGE CPP                #-}+{-# LANGUAGE OverloadedStrings  #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TemplateHaskell    #-}+#if __GLASGOW_HASKELL__ >= 806+{-# LANGUAGE DerivingVia        #-}+#endif {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module:      TextShow.Control.Exception@@ -31,14 +35,22 @@ import TextShow.TH.Internal (deriveTextShow)  -- | /Since: 2/+#if __GLASGOW_HASKELL__ >= 806+deriving via FromStringShow SomeException instance TextShow SomeException+#else instance TextShow SomeException where     showbPrec p (SomeException e) = showbPrec p $ FromStringShow e     {-# INLINE showbPrec #-}+#endif  -- | /Since: 2/+#if __GLASGOW_HASKELL__ >= 806+deriving via FromStringShow IOException instance TextShow IOException+#else instance TextShow IOException where     showb = showb . FromStringShow     {-# INLINE showb #-}+#endif  -- | /Since: 2/ instance TextShow ArithException where
src/TextShow/Data/Floating.hs view
@@ -173,6 +173,16 @@           [d]     -> singleton d <> ".0e" <> show_e'           (d:ds') -> singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> show_e'           []      -> error "formatRealFloat/doFmt/Exponent: []"+       Just 0 ->+        -- handle this case specifically since we need to omit the+        -- decimal point as well (#15115)+        case is of+          [0] -> "0e0"+          _ ->+           let+             (ei,is') = roundTo 1 is+             d:_ = map i2d (if ei > 0 then init is' else is')+           in singleton d <> singleton 'e' <> decimal (e-1+ei)        Just dec ->         let dec' = max dec 1 in         case is of
src/TextShow/Data/Monoid.hs view
@@ -30,6 +30,10 @@ import TextShow.TH.Internal (makeShowbPrec) #endif +#if MIN_VERSION_base(4,12,0)+import Data.Monoid (Ap)+#endif+ -- | /Since: 2/ $(deriveTextShow  ''All) -- | /Since: 2/@@ -66,4 +70,17 @@ -- -- /Since: 2/ $(deriveTextShow1 ''Alt)+#endif++#if MIN_VERSION_base(4,12,0)+-- | Only available with @base-4.12.0.0@ or later.+--+-- /Since: 3.7.4/+instance TextShow (f a) => TextShow (Ap f a) where+    showbPrec = $(makeShowbPrec ''Ap)++-- | Only available with @base-4.12.0.0@ or later.+--+-- /Since: 3.7.4/+$(deriveTextShow1 ''Ap) #endif
src/TextShow/FromStringTextShow.hs view
@@ -83,7 +83,8 @@  ------------------------------------------------------------------------------- --- | The 'TextShow' instance for 'FromStringShow' is based on its @String@+-- | An adapter newtype, suitable for @DerivingVia@.+-- The 'TextShow' instance for 'FromStringShow' is based on its @String@ -- 'Show' instance. That is, -- -- @@@ -146,7 +147,8 @@  ------------------------------------------------------------------------------- --- | The @String@ 'Show' instance for 'FromTextShow' is based on its+-- | An adapter newtype, suitable for @DerivingVia@.+-- The @String@ 'Show' instance for 'FromTextShow' is based on its -- 'TextShow' instance. That is, -- -- @@@ -206,7 +208,8 @@  ------------------------------------------------------------------------------- --- | The 'TextShow1' instance for 'FromStringShow1' is based on its @String@+-- | An adapter newtype, suitable for @DerivingVia@.+-- The 'TextShow1' instance for 'FromStringShow1' is based on its @String@ -- 'Show1' instance. That is, -- -- @@@ -286,7 +289,8 @@  ------------------------------------------------------------------------------- --- | The @String@ 'Show1' instance for 'FromTextShow1' is based on its+-- | An adapter newtype, suitable for @DerivingVia@.+-- The @String@ 'Show1' instance for 'FromTextShow1' is based on its -- 'TextShow1' instance. That is, -- -- @@@ -367,7 +371,8 @@  ------------------------------------------------------------------------------- --- | The 'TextShow2' instance for 'FromStringShow2' is based on its @String@+-- | An adapter newtype, suitable for @DerivingVia@.+-- The 'TextShow2' instance for 'FromStringShow2' is based on its @String@ -- 'Show2' instance. That is, -- -- @@@ -466,7 +471,8 @@  ------------------------------------------------------------------------------- --- | The @String@ 'Show2' instance for 'FromTextShow2' is based on its+-- | An adapter newtype, suitable for @DerivingVia@.+-- The @String@ 'Show2' instance for 'FromTextShow2' is based on its -- 'TextShow2' instance. That is, -- -- @
src/TextShow/Generic.hs view
@@ -1,7 +1,10 @@ {-# LANGUAGE BangPatterns          #-} {-# LANGUAGE CPP                   #-} {-# LANGUAGE DeriveDataTypeable    #-}-{-# LANGUAGE DeriveGeneric        #-}+{-# LANGUAGE DeriveFoldable        #-}+{-# LANGUAGE DeriveFunctor         #-}+{-# LANGUAGE DeriveGeneric         #-}+{-# LANGUAGE DeriveTraversable     #-} {-# LANGUAGE EmptyDataDecls        #-} {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE FlexibleInstances     #-}@@ -15,6 +18,7 @@ {-# LANGUAGE TemplateHaskell       #-} {-# LANGUAGE TypeFamilies          #-} {-# LANGUAGE TypeSynonymInstances  #-}+{-# LANGUAGE UndecidableInstances  #-}  #if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE DataKinds            #-}@@ -47,12 +51,16 @@ /Since: 2/ -} module TextShow.Generic (+      -- * Generic adapter newtypes+      FromGeneric(..)+    , FromGeneric1(..)+       -- * Generic @show@ functions       -- $generics        -- ** Understanding a compiler error       -- $generic_err-      genericShowt+    , genericShowt     , genericShowtl     , genericShowtPrec     , genericShowtlPrec@@ -97,6 +105,9 @@ import           Data.Text.Lazy.Builder (Builder)  import           Generics.Deriving.Base+#if !defined(__LANGUAGE_DERIVE_GENERIC1__)+import qualified Generics.Deriving.TH as Generics+#endif  import           GHC.Exts (Char(C#), Double(D#), Float(F#), Int(I#), Word(W#)) import           GHC.Show (appPrec, appPrec1)@@ -120,51 +131,128 @@ {- $generics  'TextShow' instances can be easily defined for data types that are 'Generic' instances.-The easiest way to do this is to use the @DeriveGeneric@ extension.+If you are using GHC 8.6 or later, the easiest way to do this is to use the+@DerivingVia@ extension.  @-&#123;-&#35; LANGUAGE DeriveGeneric &#35;-&#125;+&#123;-&#35; LANGUAGE DeriveGeneric, DerivingVia &#35;-&#125; import GHC.Generics import TextShow import TextShow.Generic  data D a = D a-  deriving (Generic, Generic1)+  deriving ('Generic', 'Generic1')+  deriving 'TextShow'  via 'FromGeneric'  (D a)+  deriving 'TextShow1' via 'FromGeneric1' D+@ -instance TextShow a => TextShow (D a) where-    showbPrec = 'genericShowbPrec'+Or, if you are using a version of GHC older than 8.6, one can alternatively+define these instances like so: -instance TextShow1 D where-    liftShowbPrec = 'genericLiftShowbPrec' @+instance 'TextShow' a => 'TextShow' (D a) where+    'showbPrec' = 'genericShowbPrec'++instance 'TextShow1' D where+    'liftShowbPrec' = 'genericLiftShowbPrec'+@ -}  {- $generic_err -Suppose you intend to use 'genericShowbPrec' to define a 'TextShow' instance.+Suppose you intend to define a 'TextShow' instance via 'FromGeneric':  @ data Oops = Oops+  deriving 'TextShow' via 'FromGeneric' Oops     -- forgot to add \"deriving Generic\" here!--instance TextShow Oops where-    showbPrec = 'genericShowbPrec' @  If you forget to add a @deriving 'Generic'@ clause to your data type, at compile-time, you might get an error message that begins roughly as follows:  @-No instance for ('GTextShowB' 'Zero' (Rep Oops))+No instance for ('GTextShowB' 'Zero' ('Rep' Oops)) @  This error can be confusing, but don't let it intimidate you. The correct fix is simply to add the missing \"@deriving 'Generic'@\" clause.  Similarly, if the compiler complains about not having an instance for @('GTextShowB'-'One' (Rep1 Oops1))@, add a \"@deriving 'Generic1'@\" clause.+'One' ('Rep1' Oops1))@, add a \"@deriving 'Generic1'@\" clause. -} +-- | An adapter newtype, suitable for @DerivingVia@.+-- The 'TextShow' instance for 'FromGeneric' leverages a 'Generic'-based+-- default. That is,+--+-- @+-- 'showbPrec' p ('FromGeneric' x) = 'genericShowbPrec' p x+-- @+--+-- /Since: 3.7.4/+newtype FromGeneric a = FromGeneric { fromGeneric :: a }+  deriving ( Data+           , Eq+           , Foldable+           , Functor+           , Ord+           , Read+           , Show+           , Traversable+           , Typeable+#if __GLASGOW_HASKELL__ >= 706+           , Generic+           , Generic1+#endif+#if __GLASGOW_HASKELL__ >= 800+           , Lift+#endif+           )++-- | /Since: 3.7.4/+instance (Generic a, GTextShowB Zero (Rep a)) => TextShow (FromGeneric a) where+  showbPrec p = genericShowbPrec p . fromGeneric++-- | An adapter newtype, suitable for @DerivingVia@.+-- The 'TextShow1' instance for 'FromGeneric1' leverages a 'Generic1'-based+-- default. That is,+--+-- @+-- 'liftShowbPrec' sp sl p ('FromGeneric1' x) = 'genericLiftShowbPrec' sp sl p x+-- @+--+-- /Since: 3.7.4/+newtype FromGeneric1 f a = FromGeneric1 { fromGeneric1 :: f a }+  deriving ( Eq+           , Ord+           , Read+           , Show+#if __GLASGOW_HASKELL__ >= 706+           , Generic+#endif+#if defined(__LANGUAGE_DERIVE_GENERIC1__)+           , Generic1+#endif+#if __GLASGOW_HASKELL__ >= 800+           , Lift+#endif+           )++deriving instance Foldable    f => Foldable    (FromGeneric1 f)+deriving instance Functor     f => Functor     (FromGeneric1 f)+deriving instance Traversable f => Traversable (FromGeneric1 f)++#if __GLASGOW_HASKELL__ >= 708+deriving instance Typeable FromGeneric1+deriving instance ( Data (f a), Typeable f, Typeable a+                  ) => Data (FromGeneric1 f (a :: *))+#endif++-- | /Since: 3.7.4/+instance (Generic1 f, GTextShowB One (Rep1 f)) => TextShow1 (FromGeneric1 f) where+  liftShowbPrec sp sl p = genericLiftShowbPrec sp sl p . fromGeneric1+ -- | A 'Generic' implementation of 'showt'. -- -- /Since: 2/@@ -302,8 +390,8 @@ dictinary lookups is likely to be as bad as converting to Text at the end, if not worse.  Therefore, I perform some ugly CPP hackery to copy-paste the generic functionality three-times, once for each Text/Builder variant. I suppose I could use TH instead to make this-look a little nicer, but I haven't attempted that.+times, once for each Text/Builder variant. At some point, I should replace this with TH.+See #33. -}  #if __GLASGOW_HASKELL__ >= 708@@ -582,4 +670,18 @@  #if __GLASGOW_HASKELL__ < 800 $(deriveLift ''ConType)+$(deriveLift ''FromGeneric)++instance Lift (f a) => Lift (FromGeneric1 f a) where+    lift = $(makeLift ''FromGeneric1)+#endif++#if !defined(__LANGUAGE_DERIVE_GENERIC1__)+$(Generics.deriveMeta           ''FromGeneric1)+$(Generics.deriveRepresentable1 ''FromGeneric1)+#endif++#if __GLASGOW_HASKELL__ < 706+$(Generics.deriveAll0And1       ''FromGeneric)+$(Generics.deriveRepresentable0 ''FromGeneric1) #endif
tests/Derived/TypeSynonyms.hs view
@@ -22,16 +22,9 @@ -} module Derived.TypeSynonyms (TyCon(..), TyFamily(..)) where -#include "generic.h"--#if !defined(__LANGUAGE_DERIVE_GENERIC1__) import qualified Generics.Deriving.TH as Generics-#endif  import           GHC.Generics (Generic)-#if __GLASGOW_HASKELL__ >= 706-import           GHC.Generics (Generic1)-#endif  import           Prelude @@ -65,9 +58,6 @@   deriving ( Arbitrary            , Show            , Generic-#if __GLASGOW_HASKELL__ >= 706-           , Generic1-#endif            )  -------------------------------------------------------------------------------@@ -84,9 +74,6 @@            , Show #if __GLASGOW_HASKELL__ >= 706            , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)-           , Generic1-# endif #endif            ) @@ -107,10 +94,8 @@ $(deriveTextShow1 ''TyCon) $(deriveTextShow2 ''TyCon) -#if __GLASGOW_HASKELL__ < 706 $(Generics.deriveMeta           ''TyCon) $(Generics.deriveRepresentable1 ''TyCon)-#endif  #if !defined(NEW_FUNCTOR_CLASSES) $(deriveShow1 'TyFamily)@@ -123,10 +108,8 @@ $(deriveTextShow1 'TyFamily) $(deriveTextShow2 'TyFamily) -#if !defined(__LANGUAGE_DERIVE_GENERIC1__) $(Generics.deriveMeta           'TyFamily) $(Generics.deriveRepresentable1 'TyFamily)-#endif  #if __GLASGOW_HASKELL__ < 706 $(Generics.deriveRepresentable0 'TyFamily)
+ tests/Instances/Data/Monoid.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE CPP #-}+#if MIN_VERSION_base(4,12,0)+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+#endif+{-|+Module:      Instances.Data.Monoid+Copyright:   (C) 2014-2017 Ryan Scott+License:     BSD-style (see the file LICENSE)+Maintainer:  Ryan Scott+Stability:   Provisional+Portability: GHC++'Arbitrary' instance for 'Ap'.+-}+module Instances.Data.Monoid () where++#if MIN_VERSION_base(4,12,0)+import Data.Monoid (Ap(..))+import Test.QuickCheck (Arbitrary)++deriving instance Arbitrary (f a) => Arbitrary (Ap f a)+#endif
tests/Instances/Foreign/C/Types.hs view
@@ -13,11 +13,44 @@  'Arbitrary' instances for data types in the "Foreign.C.Types" module. -}-module Instances.Foreign.C.Types () where+module Instances.Foreign.C.Types where -#if MIN_VERSION_base(4,10,0) import Foreign.C.Types++import Prelude ()+import Prelude.Compat+ import Test.QuickCheck (Arbitrary(..)) +import TextShow (TextShow)++#if MIN_VERSION_base(4,10,0) deriving instance Arbitrary CBool #endif++-- The following newtypes are needed to work around a QuickCheck bug+-- (https://github.com/nick8325/quickcheck/issues/201).+-- See https://github.com/RyanGlScott/text-show/issues/36.+newtype CClockHack     = CClockHack     CClock     deriving TextShow+newtype CTimeHack      = CTimeHack      CTime      deriving TextShow+newtype CUSecondsHack  = CUSecondsHack  CUSeconds  deriving TextShow+newtype CSUSecondsHack = CSUSecondsHack CSUSeconds deriving TextShow++-- Oh DerivingStrategies, how I miss thee+instance Arbitrary CClockHack where+  arbitrary = CClockHack . CClock <$> arbitrary+instance Arbitrary CTimeHack where+  arbitrary = CTimeHack . CTime <$> arbitrary+instance Arbitrary CUSecondsHack where+  arbitrary = CUSecondsHack . CUSeconds <$> arbitrary+instance Arbitrary CSUSecondsHack where+  arbitrary = CSUSecondsHack . CSUSeconds <$> arbitrary++instance Show CClockHack where+  showsPrec p (CClockHack x) = showsPrec p x+instance Show CTimeHack where+  showsPrec p (CTimeHack x) = showsPrec p x+instance Show CUSecondsHack where+  showsPrec p (CUSecondsHack x) = showsPrec p x+instance Show CSUSecondsHack where+  showsPrec p (CSUSecondsHack x) = showsPrec p x
tests/Instances/Generic.hs view
@@ -1,3 +1,11 @@+{-# LANGUAGE CPP                #-}+{-# LANGUAGE DeriveGeneric      #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TemplateHaskell    #-}+{-# LANGUAGE TypeFamilies       #-}+#if __GLASGOW_HASKELL__ >= 806+{-# LANGUAGE DerivingVia        #-}+#endif {-# OPTIONS_GHC -fno-warn-orphans #-}  {-|@@ -8,16 +16,58 @@ Stability:   Provisional Portability: GHC -'Arbitrary' instance for 'ConType'.+Provides instances for 'GenericExample', and an 'Arbitrary' instance for 'ConType'. -} module Instances.Generic () where +import GHC.Generics (Generic)+#if __GLASGOW_HASKELL__ >= 706+import GHC.Generics (Generic1)+#else+import Generics.Deriving.TH (deriveAll1)+#endif+ import Instances.Data.Text ()+import Instances.Utils (GenericExample(..)) import Instances.Utils.GenericArbitrary (genericArbitrary)  import Test.QuickCheck (Arbitrary(..)) -import TextShow.Generic (ConType(..))+import Text.Show.Deriving (deriveShow1)++import TextShow (TextShow(..), TextShow1(..))+import TextShow.Generic ( ConType(..)+#if __GLASGOW_HASKELL__ >= 806+                        , FromGeneric(..), FromGeneric1(..)+#else+                        , genericShowbPrec, genericLiftShowbPrec+#endif+                        )++deriving instance Show a => Show (GenericExample a)+$(deriveShow1 ''GenericExample)+instance Arbitrary a => Arbitrary (GenericExample a) where+  arbitrary = genericArbitrary++deriving instance Generic (GenericExample a)+#if __GLASGOW_HASKELL__ >= 706+deriving instance Generic1 GenericExample+#else+$(deriveAll1 ''GenericExample)+#endif++#if __GLASGOW_HASKELL__ >= 806+deriving via FromGeneric (GenericExample a)+  instance TextShow a => TextShow (GenericExample a)+deriving via FromGeneric1 GenericExample+  instance TextShow1 GenericExample+#else+instance TextShow a => TextShow (GenericExample a) where+  showbPrec = genericShowbPrec++instance TextShow1 GenericExample where+  liftShowbPrec = genericLiftShowbPrec+#endif  instance Arbitrary ConType where     arbitrary = genericArbitrary
tests/Instances/Utils.hs view
@@ -6,9 +6,16 @@ Stability:   Provisional Portability: GHC -A collection of utility functions.+A collection of utilities. -}-module Instances.Utils ((<@>)) where+module Instances.Utils (GenericExample(..), (<@>)) where++-- | A simple data type for testing if 'FromGeneric' and+-- 'FromGeneric1' work as intended.+data GenericExample a = GE1 a (Maybe a) (Maybe (Maybe a))+                      | GE2+                      | GE3 { ge3 :: a }+                      | a :!@#$: a  infixl 4 <@> -- | A useful way to escape a 'Functor' context.
tests/Spec/Data/FloatingSpec.hs view
@@ -27,7 +27,7 @@  import Test.Hspec (Spec, describe, hspec, parallel) import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Gen, arbitrary, suchThat)+import Test.QuickCheck (Property, (==>))  import TextShow (Builder, fromString) import TextShow.Data.Floating (showbEFloat, showbFFloat, showbGFloat,@@ -57,7 +57,13 @@  -- | Verifies @showXFloat@ and @showbXFloat@ generate the same output (where @X@ -- is one of E, F, or G).-prop_showXFloat :: (Maybe Int -> Double -> ShowS) -> (Maybe Int -> Double -> Builder) -> Double -> Gen Bool-prop_showXFloat f1 f2 val = do-    digs <- arbitrary `suchThat` (<= 10)-    pure $ fromString (f1 (Just digs) val "") == f2 (Just digs) val+prop_showXFloat :: (Maybe Int -> Double -> ShowS)+                -> (Maybe Int -> Double -> Builder)+                -> Maybe Int -> Double -> Property+prop_showXFloat f1 f2 mb_digs val =+  mb_digs /= Nothing && mb_digs <= Just 10+#if !(MIN_VERSION_base(4,12,0))+    && mb_digs /= Just 0 -- Work around Trac #15115+#endif+      ==>+    fromString (f1 mb_digs val "") == f2 mb_digs val
tests/Spec/Data/MonoidSpec.hs view
@@ -17,6 +17,8 @@  import Generics.Deriving.Instances () +import Instances.Data.Monoid ()+ import Spec.Utils (matchesTextShowSpec, genericTextShowSpec, genericTextShow1Spec)  import Test.Hspec (Spec, describe, hspec, parallel)@@ -69,6 +71,14 @@ #if MIN_VERSION_base(4,8,0)     describe "Alt Maybe Int" $ do         let p :: Proxy (Alt Maybe Int)+            p = Proxy+        matchesTextShowSpec  p+        genericTextShowSpec  p+        genericTextShow1Spec p+#endif+#if MIN_VERSION_base(4,12,0)+    describe "Ap Maybe Int" $ do+        let p :: Proxy (Ap Maybe Int)             p = Proxy         matchesTextShowSpec  p         genericTextShowSpec  p
tests/Spec/Foreign/C/TypesSpec.hs view
@@ -14,7 +14,7 @@  import Data.Proxy (Proxy(..)) import Foreign.C.Types-import Instances.Foreign.C.Types ()+import Instances.Foreign.C.Types import Spec.Utils (matchesTextShowSpec) import Test.Hspec (Spec, describe, hspec, parallel) import Test.QuickCheck.Instances ()@@ -63,13 +63,13 @@     describe "CUIntMax" $         matchesTextShowSpec (Proxy :: Proxy CUIntMax)     describe "CClock" $-        matchesTextShowSpec (Proxy :: Proxy CClock)+        matchesTextShowSpec (Proxy :: Proxy CClockHack)     describe "CTime" $-        matchesTextShowSpec (Proxy :: Proxy CTime)+        matchesTextShowSpec (Proxy :: Proxy CTimeHack)     describe "CUSeconds" $-        matchesTextShowSpec (Proxy :: Proxy CUSeconds)+        matchesTextShowSpec (Proxy :: Proxy CUSecondsHack)     describe "CSUSeconds" $-        matchesTextShowSpec (Proxy :: Proxy CSUSeconds)+        matchesTextShowSpec (Proxy :: Proxy CSUSecondsHack)     describe "CFloat" $         matchesTextShowSpec (Proxy :: Proxy CFloat)     describe "CDouble" $
tests/Spec/GenericSpec.hs view
@@ -12,7 +12,8 @@  import Data.Proxy (Proxy(..)) import Instances.Generic ()-import Spec.Utils (matchesTextShowSpec, genericTextShowSpec)+import Instances.Utils (GenericExample)+import Spec.Utils (matchesTextShowSpec, matchesTextShow1Spec, genericTextShowSpec) import Test.Hspec (Spec, describe, hspec, parallel) import TextShow.Generic (ConType) @@ -20,8 +21,14 @@ main = hspec spec  spec :: Spec-spec = parallel . describe "ConType" $ do-    let p :: Proxy ConType-        p = Proxy-    matchesTextShowSpec p-    genericTextShowSpec p+spec = parallel $ do+    describe "ConType" $ do+        let p :: Proxy ConType+            p = Proxy+        matchesTextShowSpec p+        genericTextShowSpec p+    describe "GenericExample Int" $ do+        let p :: Proxy (GenericExample Int)+            p = Proxy+        matchesTextShowSpec  p+        matchesTextShow1Spec p
text-show.cabal view
@@ -1,5 +1,5 @@ name:                text-show-version:             3.7.3+version:             3.7.4 synopsis:            Efficient conversion of values into Text description:         @text-show@ offers a replacement for the @Show@ typeclass intended                      for use with @Text@ instead of @String@s. This package was created@@ -49,7 +49,8 @@                    , GHC == 7.10.3                    , GHC == 8.0.2                    , GHC == 8.2.2-                   , GHC == 8.4.1+                   , GHC == 8.4.3+                   , GHC == 8.6.1 extra-source-files:  CHANGELOG.md, README.md, include/*.h cabal-version:       >=1.10 @@ -57,11 +58,6 @@   type:                git   location:            https://github.com/RyanGlScott/text-show -flag developer-  description:         Operate in developer mode (allows for faster recompilation of tests)-  default:             False-  manual:              True- flag base-4-9   description:         Use base-4.9 or later.   default:             True@@ -161,7 +157,7 @@                      , bifunctors            >= 5.1    && < 6                      , bytestring            >= 0.9    && < 0.11                      , bytestring-builder-                     , containers            >= 0.1    && < 0.6+                     , containers            >= 0.1    && < 0.7                      , contravariant         >= 0.5    && < 2                      , generic-deriving      >= 1.11   && < 2                      , ghc-prim@@ -175,28 +171,29 @@                      , void                  >= 0.5    && < 1    if flag(base-4-9)-    build-depends:     base                >= 4.9 && < 5+    build-depends:     base                  >= 4.9 && < 4.13     cpp-options:       "-DNEW_FUNCTOR_CLASSES"   else-    build-depends:     base                >= 4.3 && < 4.9+    build-depends:     base                  >= 4.5 && < 4.9    if flag(template-haskell-2-11)-    build-depends:     template-haskell    >= 2.11 && < 2.14-                     , ghc-boot-th         >= 8.0  && < 8.5+    build-depends:     template-haskell      >= 2.11 && < 2.15+                     , ghc-boot-th           >= 8.0  && < 8.5   else-    build-depends:     template-haskell    >= 2.5  && < 2.11+    build-depends:     template-haskell      >= 2.5  && < 2.11    if flag(new-functor-classes)-    build-depends:     transformers        (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)-                     , transformers-compat >= 0.5 && < 1+    build-depends:     transformers          (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)+                     , transformers-compat   >= 0.5 && < 1     cpp-options:       "-DNEW_FUNCTOR_CLASSES"   else-    build-depends:     transformers        == 0.4.*+    build-depends:     transformers          == 0.4.*    hs-source-dirs:      src, shared   default-language:    Haskell2010   ghc-options:         -Wall   include-dirs:        include+  includes:            generic.h  test-suite spec   type:                exitcode-stdio-1.0@@ -258,6 +255,9 @@                        -- Only exports instances if base >= 4.9                        Instances.GHC.Stack +                       -- Only exports instances if base >= 4.12+                       Instances.Data.Monoid+                        Spec.BuilderSpec                        Spec.Control.ApplicativeSpec                        Spec.Control.ConcurrentSpec@@ -339,50 +339,35 @@                        TextShow.TH.Names   build-depends:       array                 >= 0.3    && < 0.6                      , base-compat-batteries >= 0.10   && < 0.11-                     , base-orphans          >= 0.6    && < 0.8-                     , bifunctors            >= 5.1    && < 6+                     , base-orphans          >= 0.6    && < 0.9                      , bytestring            >= 0.9    && < 0.11                      , bytestring-builder-                     , containers            >= 0.1    && < 0.6-                     , contravariant         >= 0.5    && < 2                      , deriving-compat       >= 0.3.4  && < 1                      , generic-deriving      >= 1.11   && < 2                      , ghc-prim                      , hspec                 >= 2      && < 3-                     , integer-gmp                      , nats                  >= 0.1    && < 2                      , QuickCheck            >= 2.10   && < 2.12                      , quickcheck-instances  >= 0.3.18 && < 0.4                      , semigroups            >= 0.18.3 && < 1                      , tagged                >= 0.8.3  && < 1+                     , template-haskell      >= 2.5    && < 2.15                      , text                  >= 0.11.1 && < 1.3-                     , th-lift               >= 0.7.6  && < 1+                     , text-show                      , transformers-compat   >= 0.5    && < 1-                     , void                  >= 0.5    && < 1   build-tool-depends:  hspec-discover:hspec-discover    if flag(base-4-9)-    build-depends:     base                >= 4.9 && < 5+    build-depends:     base                  >= 4.9 && < 4.13     cpp-options:       "-DNEW_FUNCTOR_CLASSES"   else-    build-depends:     base                >= 4.3 && < 4.9--  if flag(template-haskell-2-11)-    build-depends:     template-haskell    >= 2.11 && < 2.14-                     , ghc-boot-th         >= 8.0  && < 8.5-  else-    build-depends:     template-haskell    >= 2.5  && < 2.11+    build-depends:     base                  >= 4.5 && < 4.9    if flag(new-functor-classes)-    build-depends:     transformers        (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)+    build-depends:     transformers          (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)     cpp-options:       "-DNEW_FUNCTOR_CLASSES"   else-    build-depends:     transformers        == 0.4.*--  if flag(developer)-    hs-source-dirs:    src-  else-    build-depends:     text-show+    build-depends:     transformers          == 0.4.*    hs-source-dirs:      tests, shared   default-language:    Haskell2010@@ -392,55 +377,15 @@                      , overlap.h  benchmark bench-  if impl(ghc < 7.4)-    buildable:         False-   type:                exitcode-stdio-1.0   main-is:             Bench.hs-  build-depends:       array                 >= 0.3    && < 0.6-                     , base-compat-batteries >= 0.10   && < 0.11-                     , bifunctors            >= 5.1    && < 6-                     , bytestring            >= 0.9    && < 0.11-                     , bytestring-builder-                     , containers            >= 0.1    && < 0.6-                     , contravariant         >= 0.5    && < 2-                     , criterion             >= 1.1.4  && < 2-                     , deepseq               >= 1.3    && < 2-                     , generic-deriving      >= 1.11   && < 2+  build-depends:       base      >= 4.5    && < 4.13+                     , criterion >= 1.1.4  && < 2+                     , deepseq   >= 1.3    && < 2                      , ghc-prim-                     , integer-gmp-                     , nats                  >= 0.1    && < 2-                     , semigroups            >= 0.17   && < 1-                     , tagged                >= 0.4.4  && < 1-                     , text                  >= 0.11.1 && < 1.3-                     , th-lift               >= 0.7.6  && < 1-                     , void                  >= 0.5    && < 1--  if flag(base-4-9)-    build-depends:     base                >= 4.9 && < 5-    cpp-options:       "-DNEW_FUNCTOR_CLASSES"-  else-    build-depends:     base                >= 4.5 && < 4.9--  if flag(template-haskell-2-11)-    build-depends:     template-haskell    >= 2.11 && < 2.14-                     , ghc-boot-th         >= 8.0  && < 8.5-  else-    build-depends:     template-haskell    >= 2.5  && < 2.11--  if flag(new-functor-classes)-    build-depends:     transformers        (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)-                     , transformers-compat >= 0.5 && < 1-    cpp-options:       "-DNEW_FUNCTOR_CLASSES"-  else-    build-depends:     transformers        == 0.4.*--  if flag(developer)-    hs-source-dirs:    src-  else-    build-depends:     text-show+                     , text-show+                     , text      >= 0.11.1 && < 1.3 -  hs-source-dirs:      benchmarks, shared+  hs-source-dirs:      benchmarks   default-language:    Haskell2010   ghc-options:         -Wall-  include-dirs:        include