packages feed

text-show-instances 3.9.6 → 3.9.7

raw patch · 7 files changed

+112/−7 lines, 7 filesdep +nonempty-vectordep ~containersdep ~hpcdep ~textPVP ok

version bump matches the API change (PVP)

Dependencies added: nonempty-vector

Dependency ranges changed: containers, hpc, text

API changes (from Hackage documentation)

+ TextShow.Data.Aeson: instance TextShow.Classes.TextShow v => TextShow.Classes.TextShow (Data.Aeson.KeyMap.KeyMap v)
+ TextShow.Data.Aeson: instance TextShow.Classes.TextShow1 Data.Aeson.KeyMap.KeyMap
+ TextShow.Data.Vector.NonEmpty: instance TextShow.Classes.TextShow a => TextShow.Classes.TextShow (Data.Vector.NonEmpty.Internal.NonEmptyVector a)
+ TextShow.Data.Vector.NonEmpty: instance TextShow.Classes.TextShow1 Data.Vector.NonEmpty.Internal.NonEmptyVector

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+### 3.9.7 [2023.10.11]+* Add `TextShow(1)` instances for `aeson`'s `KeyMap` type.+* Add `TextShow(1)` instances for `NonEmptyVector` from the `nonempty-vector`+  library.+ ### 3.9.6 [2023.08.06] * Support building with GHC 9.8. * Add `TextShow` instance for `BndrVis` in `TextShow.Language.Haskell.TH`.
src/TextShow/Data/Aeson.hs view
@@ -9,9 +9,11 @@ import Prelude () import Prelude.Compat -import TextShow (TextShow(..), fromText, showbParen, showtToShowb, singleton)+import TextShow ( TextShow(..), TextShow1(..)+                , fromText, showbParen, showbPrec1, showtToShowb, singleton ) import TextShow.Data.Scientific () import TextShow.Data.Vector ()+import TextShow.Utils (showbUnaryListWith)  instance TextShow K.Key where     showb = showtToShowb showt@@ -31,3 +33,10 @@         $ fromText "Object (fromList "         <> showbPrec 11 (KM.toAscList xs)         <> singleton ')'++instance TextShow v => TextShow (KM.KeyMap v) where+    showbPrec = showbPrec1++instance TextShow1 KM.KeyMap where+    liftShowbPrec sp sl d xs =+      showbUnaryListWith (liftShowbList sp sl) d (KM.toAscList xs)
+ src/TextShow/Data/Vector/NonEmpty.hs view
@@ -0,0 +1,25 @@+{-# OPTIONS_GHC -Wno-orphans #-}+{-|+Module:      TextShow.Data.Vector.NonEmpty+Copyright:   (C) 2023 Ryan Scott+License:     BSD-style (see the file LICENSE)+Maintainer:  Ryan Scott+Stability:   Provisional+Portability: GHC++'TextShow' instances for the @NonEmptyVector@ type.+-}+module TextShow.Data.Vector.NonEmpty () where++import qualified Data.Vector.NonEmpty as B (NonEmptyVector, toVector)++import           TextShow (TextShow(..), TextShow1(..), showbPrec1)+import           TextShow.Data.Vector ()++instance TextShow a => TextShow (B.NonEmptyVector a) where+    showbPrec = showbPrec1+    {-# INLINE showbPrec #-}++instance TextShow1 B.NonEmptyVector where+    liftShowbPrec sp sl p = liftShowbPrec sp sl p . B.toVector+    {-# INLINE liftShowbPrec #-}
+ tests/Instances/Data/Vector/NonEmpty.hs view
@@ -0,0 +1,23 @@+{-# OPTIONS_GHC -Wno-orphans #-}+{-|+Module:      Instances.Data.Vector+Copyright:   (C) 2023 Ryan Scott+License:     BSD-style (see the file LICENSE)+Maintainer:  Ryan Scott+Stability:   Provisional+Portability: GHC++Provides an 'Arbitrary' instance for the 'NonEmptyVector' type.+-}+module Instances.Data.Vector.NonEmpty () where++import           Data.Vector.NonEmpty as B (NonEmptyVector, fromNonEmpty)++import           Prelude ()+import           Prelude.Compat++import           Test.QuickCheck (Arbitrary(..))+import           Test.QuickCheck.Instances ()++instance Arbitrary a => Arbitrary (B.NonEmptyVector a) where+    arbitrary = fromNonEmpty <$> arbitrary
tests/Spec/Data/AesonSpec.hs view
@@ -12,6 +12,7 @@  import           Data.Proxy                (Proxy (..)) import           Data.Aeson                (Key, Value)+import           Data.Aeson.KeyMap         (KeyMap)  import           Spec.Utils                (matchesTextShowSpec) @@ -28,3 +29,5 @@         matchesTextShowSpec (Proxy :: Proxy Value)     describe "Aeson Key" $         matchesTextShowSpec (Proxy :: Proxy Key)+    describe "Aeson KeyMap" $+        matchesTextShowSpec (Proxy :: Proxy (KeyMap Char))
+ tests/Spec/Data/Vector/NonEmptySpec.hs view
@@ -0,0 +1,33 @@+{-|+Module:      Spec.Data.Vector.NonEmptySpec+Copyright:   (C) 2023 Ryan Scott+License:     BSD-style (see the file LICENSE)+Maintainer:  Ryan Scott+Stability:   Provisional+Portability: GHC++@hspec@ tests for the 'NonEmptyVector' type.+-}+module Spec.Data.Vector.NonEmptySpec (main, spec) where++import           Data.Proxy (Proxy(..))+import qualified Data.Vector.NonEmpty as B (NonEmptyVector)++import           Instances.Data.Vector.NonEmpty ()++import           Spec.Utils (matchesTextShowSpec, matchesTextShow1Spec)++import           Test.Hspec (Spec, describe, hspec, parallel)++import           TextShow.Data.Vector.NonEmpty ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+    describe "(boxed) NonEmptyVector Char" $ do+        let p :: Proxy (B.NonEmptyVector Char)+            p = Proxy+        matchesTextShowSpec  p+        matchesTextShow1Spec p
text-show-instances.cabal view
@@ -1,5 +1,5 @@ name:                text-show-instances-version:             3.9.6+version:             3.9.7 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@@ -23,6 +23,8 @@                      .                      * @<http://hackage.haskell.org/package/hpc                  hpc>@                      .+                     * @<http://hackage.haskell.org/package/nonempty-vector      nonempty-vector>@+                     .                      * @<http://hackage.haskell.org/package/old-locale           old-locale>@                      .                      * @<http://hackage.haskell.org/package/old-time             old-time>@@@ -105,6 +107,7 @@                        TextShow.Data.UnorderedContainers                        TextShow.Data.UUID                        TextShow.Data.Vector+                       TextShow.Data.Vector.NonEmpty                        TextShow.GHC.LanguageExtensions.Type                        TextShow.Language.Haskell.TH                        TextShow.System.Console.Haskeline@@ -131,11 +134,12 @@                      , base-compat           >= 0.10    && < 1                      , bifunctors            >= 5.2     && < 6                      , binary                >= 0.8.3   && < 0.9-                     , containers            >= 0.5.7.1 && < 0.7+                     , containers            >= 0.5.7.1 && < 0.8                      , directory             >= 1.3     && < 1.4                      , ghc-boot-th           >= 8.0     && < 9.9                      , haskeline             >= 0.7.3   && < 0.9-                     , hpc                   >= 0.6     && < 0.7+                     , hpc                   >= 0.6     && < 0.8+                     , nonempty-vector       >= 0.2     && < 0.3                      , old-locale            >= 1       && < 1.1                      , old-time              >= 1.1     && < 1.2                      , pretty                >= 1.1.3.3 && < 1.2@@ -144,7 +148,7 @@                      , semigroups            >= 0.16.2  && < 1                      , tagged                >= 0.4.4   && < 1                      , template-haskell      >= 2.11    && < 2.22-                     , text                  >= 0.11.1  && < 2.1+                     , text                  >= 0.11.1  && < 2.2                      , text-short            >= 0.1     && < 0.2                      , text-show             >= 3.4     && < 4                      , time                  >= 1.6.0.1 && < 1.13@@ -173,6 +177,7 @@                        Instances.Data.Binary                        Instances.Data.Containers                        Instances.Data.Vector+                       Instances.Data.Vector.NonEmpty                        Instances.GHC.LanguageExtensions.Type                        Instances.Language.Haskell.TH                        Instances.Miscellaneous@@ -208,6 +213,7 @@                        Spec.Data.Functor.TransSpec                        Spec.Data.ScientificSpec                        Spec.Data.ShortTextSpec+                       Spec.Data.Vector.NonEmptySpec                        Spec.Data.VectorSpec                        Spec.Data.TaggedSpec                        Spec.Data.TimeSpec@@ -239,14 +245,15 @@                      , base-compat           >= 0.10    && < 1                      , bifunctors            >= 5.5.5   && < 6                      , binary                >= 0.8.3   && < 0.9-                     , containers            >= 0.5.7.1 && < 0.7+                     , containers            >= 0.5.7.1 && < 0.8                      , directory             >= 1.3     && < 1.4                      , generic-deriving      >= 1.9     && < 2                      , ghc-boot-th           >= 8.0     && < 9.9                      , ghc-prim                      , haskeline             >= 0.7.3   && < 0.9-                     , hpc                   >= 0.6     && < 0.7+                     , hpc                   >= 0.6     && < 0.8                      , hspec                 >= 2       && < 3+                     , nonempty-vector       >= 0.2     && < 0.3                      , old-locale            >= 1       && < 1.1                      , old-time              >= 1.1     && < 1.2                      , pretty                >= 1.1.3.3 && < 1.2