on master help sign in
Older GHC compat (by @phadej)
commitcf7d1f253d09ead2b7dcca8a45ab24161ec30bba authorAdam Bergmark <adam@bergmark.nl> dateThu 23 Aug 2018, 18:40 (8 years ago) parent551f191
2 files changed+8−7
Data/Aeson/Types/ToJSON.hs+4−5 aeson.cabal+4−2
Data/Aeson/Types/ToJSON.hs+4−5
@@ -14,7 +14,6 @@
1414{-# LANGUAGE TypeOperators #-}
1515{-# LANGUAGE TypeSynonymInstances #-}
1616{-# LANGUAGE UndecidableInstances #-}
17−{-# LANGUAGE EmptyCase #-}
1817
1918#if __GLASGOW_HASKELL__ >= 706
2019{-# LANGUAGE PolyKinds #-}
@@ -92,7 +91,7 @@ import Data.Time.Format (FormatTime, formatTime)
9291import Data.Time.Locale.Compat (defaultTimeLocale)
9392import Data.Vector (Vector)
9493import Data.Version (Version, showVersion)
95−import Data.Void (Void)
94+import Data.Void (Void, absurd)
9695import Data.Word (Word16, Word32, Word64, Word8)
9796import Foreign.Storable (Storable)
9897import Foreign.C.Types (CTime (..))
@@ -707,7 +706,7 @@ instance ( AllNullary (a :+: b) allNullary
707706instance GToJSON Value arity V1 where
708707 -- Empty values do not exist, which makes the job of formatting them
709708 -- rather easy:
710− gToJSON _ _ x = case x of {}
709+ gToJSON _ _ x = x `seq` error "case: V1"
711710 {-# INLINE gToJSON #-}
712711
713712instance ToJSON a => GToJSON Value arity (K1 i a) where
@@ -1230,10 +1229,10 @@ instance (ToJSON a, ToJSON b) => ToJSON (Either a b) where
12301229 {-# INLINE toEncoding #-}
12311230
12321231instance ToJSON Void where
1233− toJSON x = case x of {}
1232+ toJSON = absurd
12341233 {-# INLINE toJSON #-}
12351234
1236− toEncoding x = case x of {}
1235+ toEncoding = absurd
12371236 {-# INLINE toEncoding #-}
12381237
12391238
aeson.cabal+4−2
@@ -135,7 +135,8 @@ library
135135
136136 if !impl(ghc >= 7.10)
137137 -- `Numeric.Natural` is available in base only since GHC 7.10 / base 4.8
138− build-depends: nats >= 1 && < 1.2
138+ build-depends: nats >= 1 && < 1.2,
139+ void >= 0.7.2 && < 0.8
139140
140141 ghc-options: -Wall
141142
@@ -227,7 +228,8 @@ test-suite tests
227228 transformers-compat >= 0.3
228229
229230 if !impl(ghc >= 7.10)
230− build-depends: nats >=1 && <1.2
231+ build-depends: nats >=1 && <1.2,
232+ void >=0.7.2 && <0.8
231233
232234 if impl(ghc >= 7.8)
233235 build-depends: hashable-time >= 0.2 && <0.3