packages feed

text-show 3.7.4 → 3.7.5

raw patch · 8 files changed

+38/−71 lines, 8 filesdep ~QuickCheck

Dependency ranges changed: QuickCheck

Files

CHANGELOG.md view
@@ -1,3 +1,11 @@+### 3.7.5 [2018.10.07]+* _Actually_ make `showbEFloat`'s behavior match that of `showEFloat` in+  `base-4.12`.+* Remove uses of `AutoDeriveTypeable`, since it is now deprecated. (As a+  result, some things which used to have `Typeable` instances on GHC 7.8+  no longer do, but I'm choosing not to be bothered by this unless someone+  shouts.)+ ### 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
src/TextShow/Data/Floating.hs view
@@ -173,16 +173,18 @@           [d]     -> singleton d <> ".0e" <> show_e'           (d:ds') -> singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> show_e'           []      -> error "formatRealFloat/doFmt/Exponent: []"-       Just 0 ->+       Just d | d <= 0 ->         -- handle this case specifically since we need to omit the-        -- decimal point as well (#15115)+        -- decimal point as well (#15115).+        -- Note that this handles negative precisions as well for consistency+        -- (see #15509).         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)+             n:_ = map i2d (if ei > 0 then init is' else is')+           in singleton n <> singleton 'e' <> decimal (e-1+ei)        Just dec ->         let dec' = max dec 1 in         case is of
src/TextShow/FromStringTextShow.hs view
@@ -17,10 +17,6 @@ {-# LANGUAGE PolyKinds                  #-} #endif -#if __GLASGOW_HASKELL__ >= 708-{-# LANGUAGE AutoDeriveTypeable         #-}-#endif- #if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DeriveLift                 #-} #endif
src/TextShow/Options.hs view
@@ -4,15 +4,6 @@ {-# LANGUAGE TemplateHaskell    #-} {-# LANGUAGE TypeFamilies       #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds          #-}-{-# LANGUAGE PolyKinds          #-}-#endif--#if __GLASGOW_HASKELL__ >= 708-{-# LANGUAGE AutoDeriveTypeable #-}-#endif- #if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DeriveLift         #-} #endif@@ -31,12 +22,12 @@ -} module TextShow.Options (Options(..), GenTextMethods(..), defaultOptions) where -import           Data.Data (Data, Typeable)-import           Data.Ix (Ix)+import Data.Data (Data, Typeable)+import Data.Ix (Ix) -import           GHC.Generics (Generic)+import GHC.Generics (Generic) -import           Language.Haskell.TH.Lift+import Language.Haskell.TH.Lift  -- | Options that specify how to derive 'TextShow' instances using Template Haskell. --
tests/Instances/Foreign/C/Types.hs view
@@ -13,44 +13,11 @@  '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/Spec/Data/FloatingSpec.hs view
@@ -27,7 +27,7 @@  import Test.Hspec (Spec, describe, hspec, parallel) import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Property, (==>))+import Test.QuickCheck (Property, arbitrary, property, suchThat)  import TextShow (Builder, fromString) import TextShow.Data.Floating (showbEFloat, showbFFloat, showbGFloat,@@ -59,11 +59,14 @@ -- is one of E, F, or G). 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+                -> Double -> Property+prop_showXFloat f1 f2 val = property $ do+  mb_digs <- arbitrary `suchThat` cond+  pure $ fromString (f1 mb_digs val "") == f2 mb_digs val+  where+    cond :: Maybe Int -> Bool+    cond mb_digs =+      mb_digs /= Nothing && mb_digs <= Just 10 #if !(MIN_VERSION_base(4,12,0))-    && mb_digs /= Just 0 -- Work around Trac #15115+      && mb_digs > Just 0 -- Work around Trac #15115 #endif-      ==>-    fromString (f1 mb_digs val "") == f2 mb_digs val
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 CClockHack)+        matchesTextShowSpec (Proxy :: Proxy CClock)     describe "CTime" $-        matchesTextShowSpec (Proxy :: Proxy CTimeHack)+        matchesTextShowSpec (Proxy :: Proxy CTime)     describe "CUSeconds" $-        matchesTextShowSpec (Proxy :: Proxy CUSecondsHack)+        matchesTextShowSpec (Proxy :: Proxy CUSeconds)     describe "CSUSeconds" $-        matchesTextShowSpec (Proxy :: Proxy CSUSecondsHack)+        matchesTextShowSpec (Proxy :: Proxy CSUSeconds)     describe "CFloat" $         matchesTextShowSpec (Proxy :: Proxy CFloat)     describe "CDouble" $
text-show.cabal view
@@ -1,5 +1,5 @@ name:                text-show-version:             3.7.4+version:             3.7.5 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@@ -178,7 +178,7 @@    if flag(template-haskell-2-11)     build-depends:     template-haskell      >= 2.11 && < 2.15-                     , ghc-boot-th           >= 8.0  && < 8.5+                     , ghc-boot-th           >= 8.0  && < 8.7   else     build-depends:     template-haskell      >= 2.5  && < 2.11 @@ -347,7 +347,7 @@                      , ghc-prim                      , hspec                 >= 2      && < 3                      , nats                  >= 0.1    && < 2-                     , QuickCheck            >= 2.10   && < 2.12+                     , QuickCheck            >= 2.12   && < 2.13                      , quickcheck-instances  >= 0.3.18 && < 0.4                      , semigroups            >= 0.18.3 && < 1                      , tagged                >= 0.8.3  && < 1