@@ -91,6 +91,7 @@ import Data.Time.Format (FormatTime, formatTime)
9191import Data.Time.Locale.Compat (defaultTimeLocale)
9292import Data.Vector (Vector)
9393import Data.Version (Version, showVersion)
94+import Data.Void (Void, absurd)
9495import Data.Word (Word16, Word32, Word64, Word8)
9596import Foreign.Storable (Storable)
9697import Foreign.C.Types (CTime (..))
@@ -702,6 +703,12 @@ instance ( AllNullary (a :+: b) allNullary
702703-- possible but makes error messages a bit harder to understand for missing
703704-- instances.
704705
706+instance GToJSON Value arity V1 where
707+ -- Empty values do not exist, which makes the job of formatting them
708+ -- rather easy:
709+ gToJSON _ _ x = x `seq` error "case: V1"
710+ {-# INLINE gToJSON #-}
711+
705712instance ToJSON a => GToJSON Value arity (K1 i a) where
706713 -- Constant values are encoded using their ToJSON instance:
707714 gToJSON _opts _ = toJSON . unK1
@@ -1221,6 +1228,13 @@ instance (ToJSON a, ToJSON b) => ToJSON (Either a b) where
12211228 toEncoding = toEncoding2
12221229 {-# INLINE toEncoding #-}
12231230
1231+instance ToJSON Void where
1232+ toJSON = absurd
1233+ {-# INLINE toJSON #-}
1234+
1235+ toEncoding = absurd
1236+ {-# INLINE toEncoding #-}
1237+
12241238
12251239instance ToJSON Bool where
12261240 toJSON = Bool