@@ -91,6 +91,7 @@ import Data.Time.Format (FormatTime, formatTime)
91import Data.Time.Locale.Compat (defaultTimeLocale)
91import Data.Time.Locale.Compat (defaultTimeLocale)
92import Data.Vector (Vector)
92import Data.Vector (Vector)
93import Data.Version (Version, showVersion)
93import Data.Version (Version, showVersion)
94+import Data.Void (Void, absurd)
94import Data.Word (Word16, Word32, Word64, Word8)
95import Data.Word (Word16, Word32, Word64, Word8)
95import Foreign.Storable (Storable)
96import Foreign.Storable (Storable)
96import Foreign.C.Types (CTime (..))
97import Foreign.C.Types (CTime (..))
@@ -702,6 +703,12 @@ instance ( AllNullary (a :+: b) allNullary
702-- possible but makes error messages a bit harder to understand for missing
703-- possible but makes error messages a bit harder to understand for missing
703-- instances.
704-- instances.
706+instance GToJSON Value arity V1 where
707+ -- Empty values do not exist, which makes the job of formatting them
709+ gToJSON _ _ x = x `seq` error "case: V1"
710+ {-# INLINE gToJSON #-}
705instance ToJSON a => GToJSON Value arity (K1 i a) where
712instance ToJSON a => GToJSON Value arity (K1 i a) where
706 -- Constant values are encoded using their ToJSON instance:
713 -- Constant values are encoded using their ToJSON instance:
707 gToJSON _opts _ = toJSON . unK1
714 gToJSON _opts _ = toJSON . unK1
@@ -1221,6 +1228,13 @@ instance (ToJSON a, ToJSON b) => ToJSON (Either a b) where
1221 toEncoding = toEncoding2
1228 toEncoding = toEncoding2
1222 {-# INLINE toEncoding #-}
1229 {-# INLINE toEncoding #-}
1231+instance ToJSON Void where
1233+ {-# INLINE toJSON #-}
1235+ toEncoding = absurd
1236+ {-# INLINE toEncoding #-}
1225instance ToJSON Bool where
1239instance ToJSON Bool where
1226 toJSON = Bool
1240 toJSON = Bool