packages feed

aeson 2.0.1.0 → 2.0.2.0

raw patch · 16 files changed

+192/−25 lines, 16 filesdep +OneTupledep +text-shortdep ~ghc-primdep ~hashabledep ~quickcheck-instancesPVP ok

version bump matches the API change (PVP)

Dependencies added: OneTuple, text-short

Dependency ranges changed: ghc-prim, hashable, quickcheck-instances, template-haskell, th-abstraction, time

API changes (from Hackage documentation)

+ Data.Aeson.Encoding: shortText :: ShortText -> Encoding' a
+ Data.Aeson.Encoding.Internal: shortText :: ShortText -> Encoding' a
+ Data.Aeson.Key: fromShortText :: ShortText -> Key
+ Data.Aeson.Key: toShortText :: Key -> ShortText
+ Data.Aeson.KeyMap: fromMapText :: Map Text v -> KeyMap v
+ Data.Aeson.KeyMap: instance GHC.Exts.IsList (Data.Aeson.KeyMap.KeyMap v)
+ Data.Aeson.KeyMap: toMapText :: KeyMap v -> Map Text v

Files

aeson.cabal view
@@ -1,5 +1,5 @@ name:               aeson-version:            2.0.1.0+version:            2.0.2.0 license:            BSD3 license-file:       LICENSE category:           Text, Web, JSON@@ -60,9 +60,7 @@   manual:      True  flag ordered-keymap-  description:-    Use ordered @Data.Map.Strict@ for KeyMap implementation.-+  description: Use ordered @Data.Map.Strict@ for KeyMap implementation.   default:     True   manual:      True @@ -103,10 +101,10 @@     , bytestring        >=0.10.8.1 && <0.12     , containers        >=0.5.7.1  && <0.7     , deepseq           >=1.4.2.0  && <1.5-    , ghc-prim          >=0.5.0.0  && <0.8-    , template-haskell  >=2.11.0.0 && <2.18+    , ghc-prim          >=0.5.0.0  && <0.9+    , template-haskell  >=2.11.0.0 && <2.19     , text              >=1.2.3.0  && <1.3-    , time              >=1.6.0.1  && <1.12+    , time              >=1.6.0.1  && <1.13    -- Compat   build-depends:@@ -121,14 +119,16 @@       attoparsec            >=0.13.2.2 && <0.15     , data-fix              >=0.3      && <0.4     , dlist                 >=0.8.0.4  && <1.1-    , hashable              >=1.2.7.0  && <1.4+    , hashable              >=1.3.5.0  && <1.5     , indexed-traversable   >=0.1.1    && <0.2+    , OneTuple              >=0.3.1    && <0.4     , primitive             >=0.7.0.1  && <0.8     , scientific            >=0.3.7.0  && <0.4     , semialign             >=1.2      && <1.3     , strict                >=0.4      && <0.5     , tagged                >=0.8.6    && <0.9-    , th-abstraction        >=0.2.8.0  && <0.5+    , text-short            >=0.1.4    && <0.2+    , th-abstraction        >=0.3.0.0  && <0.5     , these                 >=1.1      && <1.2     , unordered-containers  >=0.2.10.0 && <0.3     , uuid-types            >=1.0.3    && <1.1@@ -196,10 +196,11 @@     , filepath     , generic-deriving      >=1.10     && <1.15     , ghc-prim              >=0.2-    , hashable              >=1.2.4.0+    , hashable     , integer-logarithms    >=1        && <1.1+    , OneTuple     , QuickCheck            >=2.14.2   && <2.15-    , quickcheck-instances  >=0.3.25.2 && <0.4+    , quickcheck-instances  >=0.3.26.1 && <0.4     , scientific     , strict     , tagged@@ -209,6 +210,7 @@     , tasty-quickcheck     , template-haskell     , text+    , text-short     , these     , time     , time-compat
changelog.md view
@@ -1,8 +1,15 @@ For the latest version of this document, please see [https://github.com/haskell/aeson/blob/master/changelog.md](https://github.com/haskell/aeson/blob/master/changelog.md). +### 2.0.2.0++* Add `IsList (KeyMap v)` instance.+* Add `toMapText` and `fromMapText` to `Data.Aeson.KeyMap`.+* Add `ShortText` instances+* Add `Solo` instances+ ### 2.0.1.0 -* Add FromJSON KeyMap instances+* Add `FromJSON KeyMap` instance. * Make `ordered-keymap` on by default.  ### 2.0.0.0
src/Data/Aeson/Encoding.hs view
@@ -25,6 +25,7 @@     , emptyObject_     , text     , lazyText+    , shortText     , string     , list     , dict
src/Data/Aeson/Encoding/Internal.hs view
@@ -29,6 +29,7 @@     , key     , text     , lazyText+    , shortText     , string     , list     , dict@@ -77,6 +78,7 @@ import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Lazy as BSL import qualified Data.Text.Lazy as LT+import qualified Data.Text.Short as ST  -- | An encoding of a JSON value. --@@ -238,6 +240,14 @@ lazyText t = Encoding $     B.char7 '"' <>     LT.foldrChunks (\x xs -> EB.unquoted x <> xs) (B.char7 '"') t++-- | @since 2.0.2.0+shortText :: ST.ShortText -> Encoding' a+shortText t = Encoding $+    B.char7 '"' <>+    -- TODO: if we can determine whether all characters are >=0x20 && <0x80+    -- we could use underlying ShortByteString directly.+    EB.unquoted (ST.toText t) <> B.char7 '"'  string :: String -> Encoding' a string = Encoding . EB.string
src/Data/Aeson/Key.hs view
@@ -10,6 +10,8 @@     toText,     fromText,     coercionToText,+    toShortText,+    fromShortText, ) where  import Prelude (Eq, Ord, (.), Show (..), String, Maybe (..))@@ -27,6 +29,7 @@  import qualified Data.String import qualified Data.Text as T+import qualified Data.Text.Short as ST import qualified Language.Haskell.TH.Syntax as TH  newtype Key = Key { unKey :: Text }@@ -53,6 +56,14 @@ coercionToText :: Maybe (Coercion Key Text) coercionToText = Just Coercion {-# INLINE coercionToText #-}++-- | @since 2.0.2.0+toShortText :: Key -> ST.ShortText+toShortText = ST.fromText . unKey++-- | @since 2.0.2.0+fromShortText :: ST.ShortText -> Key+fromShortText = Key . ST.toText  ------------------------------------------------------------------------------- -- instances
src/Data/Aeson/KeyMap.hs view
@@ -1,9 +1,10 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-}-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskellQuotes #-}+{-# LANGUAGE TypeFamilies #-}  -- | -- An abstract interface for maps from JSON keys to values.@@ -51,12 +52,14 @@     -- * Maps     fromHashMap,     toHashMap,+    fromHashMapText,+    toHashMapText,     coercionToHashMap,     fromMap,     toMap,+    fromMapText,+    toMapText,     coercionToMap,-    fromHashMapText,-    toHashMapText,      -- * Traversal     -- ** Map@@ -117,6 +120,7 @@ import qualified Data.Traversable.WithIndex as WI (TraversableWithIndex (..)) import qualified Data.Semialign as SA import qualified Data.Semialign.Indexed as SAI+import qualified GHC.Exts import qualified Witherable as W  #ifdef USE_ORDEREDMAP@@ -481,7 +485,7 @@  -- | Convert a 'KeyMap' to a 'Map'. toMap :: KeyMap v -> Map Key v-toMap = M.fromList . toList +toMap = M.fromList . toList  -- | Convert a 'HashMap' to a 'Map'. fromMap :: Map Key v -> KeyMap v@@ -539,6 +543,18 @@ fromHashMapText :: HashMap Text v -> KeyMap v fromHashMapText = fromList . L.map (first Key.fromText) . H.toList +-- | Convert a 'KeyMap' to a @'Map' 'Text'@.+--+-- @since 2.0.2.0+toMapText :: KeyMap v -> Map Text v+toMapText = M.fromList . L.map (first Key.toText) . toList++-- | Convert a @'Map' 'Text'@to a 'KeyMap'.+--+-- @since 2.0.2.0+fromMapText :: Map Text v -> KeyMap v+fromMapText = fromList . L.map (first Key.fromText) . M.toList+ ------------------------------------------------------------------------------- -- Instances -------------------------------------------------------------------------------@@ -576,6 +592,12 @@ instance Monoid (KeyMap v) where     mempty = empty     mappend = (<>)++-- | @since 2.0.2.0+instance GHC.Exts.IsList (KeyMap v) where+    type Item (KeyMap v) = (Key, v)+    fromList = fromList+    toList   = toAscList  ------------------------------------------------------------------------------- -- template-haskell
src/Data/Aeson/Types/FromJSON.hs view
@@ -109,6 +109,7 @@ import Data.Time.Clock.System.Compat (SystemTime (..)) import Data.Time.Format.Compat (parseTimeM, defaultTimeLocale) import Data.Traversable as Tr (sequence)+import Data.Tuple.Solo (Solo (..)) import Data.Type.Coercion (Coercion (..)) import Data.Vector (Vector) import Data.Version (Version, parseVersion)@@ -144,6 +145,7 @@ import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as LT+import qualified Data.Text.Short as ST import qualified Data.Tree as Tree import qualified Data.UUID.Types as UUID import qualified Data.Vector as V@@ -1693,7 +1695,15 @@ instance FromJSONKey LT.Text where     fromJSONKey = FromJSONKeyText LT.fromStrict +-- | @since 2.0.2.0+instance FromJSON ST.ShortText where+    parseJSON = withText "Lazy Text" $ pure . ST.fromText +-- | @since 2.0.2.0+instance FromJSONKey ST.ShortText where+    fromJSONKey = FromJSONKeyText ST.fromText++ instance FromJSON Version where     parseJSON = withText "Version" parseVersionText @@ -1755,6 +1765,25 @@ #endif  -------------------------------------------------------------------------------+-- OneTuple+-------------------------------------------------------------------------------++-- | @since 2.0.2.0+instance FromJSON1 Solo where+    liftParseJSON p _ a = Solo <$> p a+    liftParseJSONList _ p a = fmap Solo <$> p a++-- | @since 2.0.2.0+instance (FromJSON a) => FromJSON (Solo a) where+    parseJSON = parseJSON1+    parseJSONList = liftParseJSONList parseJSON parseJSONList++-- | @since 2.0.2.0+instance (FromJSONKey a) => FromJSONKey (Solo a) where+    fromJSONKey     = fmap Solo fromJSONKey+    fromJSONKeyList = fmap (map Solo) fromJSONKeyList++------------------------------------------------------------------------------- -- transformers - Functors ------------------------------------------------------------------------------- @@ -1860,7 +1889,9 @@                 Just Coercion -> uc . M.traverseWithKey (\k v -> p v <?> Key k) . KM.toMap         FromJSONKeyText f -> withObject "Map" (text f)         FromJSONKeyTextParser f -> withObject "Map" $-            KM.foldrWithKey (\k v m -> M.insert <$> f (Key.toText k) <?> Key k <*> p v <?> Key k <*> m) (pure M.empty)+            KM.foldrWithKey+                (\k v m -> M.insert <$> f (Key.toText k) <?> Key k <*> p v <?> Key k <*> m)+                (pure M.empty)         FromJSONKeyValue f -> withArray "Map" $ \arr ->             fmap M.fromList . Tr.sequence .                 zipWith (parseIndexedJSONPair f p) [0..] . V.toList $ arr@@ -1945,9 +1976,9 @@                 Just Coercion -> uc . H.traverseWithKey (\k v -> p v <?> Key k) . KM.toHashMap         FromJSONKeyText f -> withObject "HashMap" (text f)         FromJSONKeyTextParser f -> withObject "HashMap" $-          H.foldrWithKey-            (\k v m -> H.insert <$> f (Key.toText k) <?> Key k <*> p v <?> Key k <*> m) (pure H.empty)-            . KM.toHashMap+            KM.foldrWithKey+                (\k v m -> H.insert <$> f (Key.toText k) <?> Key k <*> p v <?> Key k <*> m)+                (pure H.empty)         FromJSONKeyValue f -> withArray "Map" $ \arr ->             fmap H.fromList . Tr.sequence .                 zipWith (parseIndexedJSONPair f p) [0..] . V.toList $ arr
src/Data/Aeson/Types/Generic.hs view
@@ -37,12 +37,13 @@     ) where  import Prelude.Compat+import Data.Kind (Type)  import GHC.Generics  -------------------------------------------------------------------------------- -class IsRecord (f :: * -> *) isRecord | f -> isRecord+class IsRecord (f :: Type -> Type) isRecord | f -> isRecord  instance (IsRecord f isRecord) => IsRecord (f :*: g) isRecord instance {-# OVERLAPPING #-} IsRecord (M1 S ('MetaSel 'Nothing u ss ds) f) False@@ -55,7 +56,7 @@  -------------------------------------------------------------------------------- -class AllNullary (f :: * -> *) allNullary | f -> allNullary+class AllNullary (f :: Type -> Type) allNullary | f -> allNullary  instance ( AllNullary a allNullaryL          , AllNullary b allNullaryR@@ -69,7 +70,7 @@ instance AllNullary (Rec1 f) False instance AllNullary U1 True -newtype Tagged2 (s :: * -> *) b = Tagged2 {unTagged2 :: b}+newtype Tagged2 (s :: Type -> Type) b = Tagged2 {unTagged2 :: b}   deriving Functor  --------------------------------------------------------------------------------
src/Data/Aeson/Types/ToJSON.hs view
@@ -93,6 +93,7 @@ import Data.Time.LocalTime.Compat (CalendarDiffTime (..)) import Data.Time.Clock.System.Compat (SystemTime (..)) import Data.Time.Format.Compat (FormatTime, formatTime, defaultTimeLocale)+import Data.Tuple.Solo (Solo (..), getSolo) import Data.Vector (Vector) import Data.Version (Version, showVersion) import Data.Void (Void, absurd)@@ -124,6 +125,7 @@ import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as LT+import qualified Data.Text.Short as ST import qualified Data.Tree as Tree import qualified Data.UUID.Types as UUID import qualified Data.Vector as V@@ -1457,7 +1459,6 @@ instance ToJSONKey Text where     toJSONKey = toJSONKeyText id - instance ToJSON LT.Text where     toJSON = String . LT.toStrict     toEncoding = E.lazyText@@ -1465,7 +1466,16 @@ instance ToJSONKey LT.Text where     toJSONKey = toJSONKeyText (LT.toStrict) +-- | @since 2.0.2.0+instance ToJSON ST.ShortText where+    toJSON = String . ST.toText+    toEncoding = E.shortText +-- | @since 2.0.2.0+instance ToJSONKey ST.ShortText where+    toJSONKey = ToJSONKeyText Key.fromShortText E.shortText++ instance ToJSON Version where     toJSON = toJSON . showVersion     toEncoding = toEncoding . showVersion@@ -1519,6 +1529,31 @@     toJSON = toJSON1     toEncoding = toEncoding1 #endif++-------------------------------------------------------------------------------+-- OneTuple+-------------------------------------------------------------------------------++-- | @since 2.0.2.0+instance ToJSON1 Solo where+    liftToJSON t _ (Solo a) = t a+    liftToJSONList _ tl xs = tl (map getSolo xs)++    liftToEncoding t _ (Solo a) = t a+    liftToEncodingList _ tl xs = tl (map getSolo xs)++-- | @since 2.0.2.0+instance (ToJSON a) => ToJSON (Solo a) where+    toJSON = toJSON1+    toJSONList = liftToJSONList toJSON toJSONList++    toEncoding = toEncoding1+    toEncodingList = liftToEncodingList toEncoding toEncodingList++-- | @since 2.0.2.0+instance (ToJSONKey a) => ToJSONKey (Solo a) where+    toJSONKey = contramapToJSONKeyFunction getSolo toJSONKey+    toJSONKeyList = contramapToJSONKeyFunction (map getSolo) toJSONKeyList  ------------------------------------------------------------------------------- -- transformers - Functors
tests/Encoders.hs view
@@ -272,6 +272,7 @@ -- Option fields -------------------------------------------------------------------------------- +#if !MIN_VERSION_base(4,16,0) thOptionFieldToJSON :: OptionField -> Value thOptionFieldToJSON = $(mkToJSON optsOptionField 'OptionField) @@ -289,6 +290,7 @@  gOptionFieldParseJSON :: Value -> Parser OptionField gOptionFieldParseJSON = genericParseJSON optsOptionField+#endif  thMaybeFieldToJSON :: MaybeField -> Value thMaybeFieldToJSON = $(mkToJSON optsOptionField 'MaybeField)
tests/Instances.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoImplicitPrelude #-}@@ -156,8 +157,10 @@ instance Arbitrary (GADT String) where     arbitrary = GADT <$> arbitrary +#if !MIN_VERSION_base(4,16,0) instance Arbitrary OptionField where     arbitrary = OptionField <$> arbitrary+#endif   instance ApproxEq Char where
tests/PropertyGeneric.hs view
@@ -5,13 +5,17 @@  import Prelude.Compat +#if !MIN_VERSION_base(4,16,0) import Data.Semigroup (Option(..))+#endif import Encoders import Instances () import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (testProperty)+#if !MIN_VERSION_base(4,16,0) import Test.QuickCheck ( (===) ) import Types+#endif import PropUtils  @@ -57,11 +61,13 @@           , testProperty "Tagged"  (toParseJSON gOneConstructorParseJSONTagged  gOneConstructorToJSONTagged)           ]         ]+#if !MIN_VERSION_base(4,16,0)       , testGroup "OptionField" [           testProperty "like Maybe" $           \x -> gOptionFieldToJSON (OptionField (Option x)) === thMaybeFieldToJSON (MaybeField x)         , testProperty "roundTrip" (toParseJSON gOptionFieldParseJSON gOptionFieldToJSON)         ]+#endif       ]     , testGroup "toEncoding" [         testProperty "NullaryString" $@@ -110,7 +116,9 @@       , testProperty "OneConstructorTagged" $         gOneConstructorToJSONTagged `sameAs` gOneConstructorToEncodingTagged +#if !MIN_VERSION_base(4,16,0)       , testProperty "OptionField" $         gOptionFieldToJSON `sameAs` gOptionFieldToEncoding+#endif       ]     ]
tests/PropertyRoundTrip.hs view
@@ -20,19 +20,21 @@ import Data.Time.Calendar.Compat (CalendarDiffDays, DayOfWeek) import Data.Time.LocalTime.Compat (CalendarDiffTime) import Data.Time.Clock.System.Compat (SystemTime)-import Instances ()+import Data.Tuple.Solo (Solo) import Numeric.Natural (Natural) import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (testProperty) import Types import qualified Data.Text as T import qualified Data.Text.Lazy as LT+import qualified Data.Text.Short as ST import qualified Data.UUID.Types as UUID import qualified Data.Strict as S import qualified Data.Fix as F import PropUtils import PropertyRTFunctors +import Instances ()  roundTripTests :: TestTree roundTripTests =@@ -81,6 +83,8 @@     , testProperty "Strict Either" $ roundTripEq (undefined :: S.Either Int Char)     , testProperty "Strict These" $ roundTripEq (undefined :: S.These Int Char)     , testProperty "Strict Maybe" $ roundTripEq (undefined :: S.Maybe Int)+    , testProperty "Solo Int" $ roundTripEq (undefined :: Solo Int)+    , testProperty "ShortText" $ roundTripEq (undefined :: ST.ShortText)     , roundTripFunctorsTests     , testGroup "ghcGenerics" [         testProperty "OneConstructor" $ roundTripEq OneConstructor
tests/PropertyTH.hs view
@@ -1,16 +1,21 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE NoImplicitPrelude #-}  module PropertyTH ( templateHaskellTests ) where  import Prelude.Compat +#if !MIN_VERSION_base(4,16,0) import Data.Semigroup (Option(..))+#endif import Encoders import Instances () import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (testProperty)+#if !MIN_VERSION_base(4,16,0) import Test.QuickCheck ( (===) ) import Types+#endif import PropUtils  @@ -74,11 +79,13 @@           , testProperty "Tagged"  (toParseJSON thOneConstructorParseJSONTagged  thOneConstructorToJSONTagged)           ]         ]+#if !MIN_VERSION_base(4,16,0)       , testGroup "OptionField" [           testProperty "like Maybe" $           \x -> thOptionFieldToJSON (OptionField (Option x)) === thMaybeFieldToJSON (MaybeField x)         , testProperty "roundTrip" (toParseJSON thOptionFieldParseJSON thOptionFieldToJSON)         ]+#endif       ]     , testGroup "toEncoding" [         testProperty "NullaryString" $@@ -124,7 +131,9 @@       , testProperty "OneConstructorTagged" $         thOneConstructorToJSONTagged `sameAs` thOneConstructorToEncodingTagged +#if !MIN_VERSION_base(4,16,0)       , testProperty "OptionField" $         thOptionFieldToJSON `sameAs` thOptionFieldToEncoding+#endif       ]     ]
tests/SerializationFormatSpec.hs view
@@ -29,6 +29,7 @@ import Data.Proxy (Proxy(..)) import Data.Scientific (Scientific) import Data.Tagged (Tagged(..))+import Data.Text (Text) import Data.These (These (..)) import Data.Time (fromGregorian) import Data.Time.Calendar.Month.Compat (fromYearMonth)@@ -36,6 +37,7 @@ import Data.Time.Calendar.Compat (CalendarDiffDays (..), DayOfWeek (..)) import Data.Time.LocalTime.Compat (CalendarDiffTime (..)) import Data.Time.Clock.System.Compat (SystemTime (..))+import Data.Tuple.Solo (Solo (..)) import Data.Word (Word8) import GHC.Generics (Generic) import Instances ()@@ -58,6 +60,8 @@ import qualified Data.Vector as Vector import qualified Data.Fix as F import qualified Data.Strict as S+import qualified Data.Text.Lazy as LT+import qualified Data.Text.Short as ST  tests :: [TestTree] tests =@@ -89,6 +93,10 @@   , example "DList" "[1,2,3]"  (DList.fromList [1, 2, 3] :: DList.DList Int)   , example "()" "[]"  () +  , example "Text" "\"foo\"" ("foo" :: Text)+  , example "Lazy Text" "\"foo\"" ("foo" :: LT.Text)+  , example "ShortText" "\"foo\"" ("foo" :: ST.ShortText)+   , ndExample "HashMap Int Int"         [ "{\"0\":1,\"2\":3}", "{\"2\":3,\"0\":1}"]         (HM.fromList [(0,1),(2,3)] :: HM.HashMap Int Int)@@ -137,11 +145,16 @@    -- Functors   , example "Identity Int" "1"  (pure 1 :: Identity Int)+  , example "Solo Int" "1"      (pure 1 :: Solo Int)    , example "Identity Char" "\"x\""      (pure 'x' :: Identity Char)   , example "Identity String" "\"foo\""  (pure "foo" :: Identity String)   , example "[Identity Char]" "\"xy\""   ([pure 'x', pure 'y'] :: [Identity Char]) +  , example "Solo Char" "\"x\""      (pure 'x' :: Solo Char)+  , example "Solo String" "\"foo\""  (pure "foo" :: Solo String)+  , example "[Solo Char]" "\"xy\""   ([pure 'x', pure 'y'] :: [Solo Char])+   , example "Maybe Char" "\"x\""              (pure 'x' :: Maybe Char)   , example "Maybe String" "\"foo\""          (pure "foo" :: Maybe String)   , example "Maybe [Identity Char]" "\"xy\""  (pure [pure 'x', pure 'y'] :: Maybe [Identity Char])@@ -214,8 +227,10 @@   , example "Semigroup.First Int" "2" (pure 2 :: Semigroup.First Int)   , example "Semigroup.Last Int" "2" (pure 2 :: Semigroup.Last Int)   , example "Semigroup.WrappedMonoid Int" "2" (Semigroup.WrapMonoid 2 :: Semigroup.WrappedMonoid Int)+#if !MIN_VERSION_base(4,16,0)   , example "Semigroup.Option Just" "2" (pure 2 :: Semigroup.Option Int)   , example "Semigroup.Option Nothing" "null" (Semigroup.Option (Nothing :: Maybe Bool))+#endif    -- time 1.9   , example "SystemTime" "123.123456789" (MkSystemTime 123 123456789)
tests/Types.hs view
@@ -18,7 +18,9 @@ import Data.Functor.Compose (Compose (..)) import Data.Functor.Identity (Identity (..)) import Data.Hashable (Hashable (..))+#if !MIN_VERSION_base(4,16,0) import Data.Semigroup (Option)+#endif import Data.Text import Data.Time (Day (..), fromGregorian) import GHC.Generics@@ -107,8 +109,10 @@ deriving instance Show (GADT a)  newtype MaybeField = MaybeField { maybeField :: Maybe Int }+#if !MIN_VERSION_base(4,16,0) newtype OptionField = OptionField { optionField :: Option Int }   deriving (Eq, Show)+#endif  deriving instance Generic Foo deriving instance Generic UFoo@@ -120,7 +124,9 @@ deriving instance Generic Nullary deriving instance Generic (SomeType a) deriving instance Generic1 SomeType+#if !MIN_VERSION_base(4,16,0) deriving instance Generic OptionField+#endif deriving instance Generic EitherTextInt  failure :: Show a => String -> String -> a -> Property