on master help sign in
Merge pull request #573 from Lysxia/incoherent-tojson

Add INCOHERENT pragma to RecordToPair

commit475058cd6276366e776ca18e250295e77fdc4995 authorAdam Bergmark <adam@bergmark.nl> dateTue 15 Aug 2017, 17:13 (9 years ago) parentd34cede368dcf2
2 files changed+7−1
Data/Aeson/Types/ToJSON.hs+2−1 tests/Encoders.hs+5
Data/Aeson/Types/ToJSON.hs+2−1
@@ -20,6 +20,7 @@
2020#endif
2121
2222#include "overlapping-compat.h"
23+#include "incoherent-compat.h"
2324
2425-- TODO: Drop this when we remove support for Data.Attoparsec.Number
2526{-# OPTIONS_GHC -fno-warn-deprecations #-}
@@ -1009,7 +1010,7 @@ instance ( Selector s
10091010 recordToPairs = fieldToPair
10101011 {-# INLINE recordToPairs #-}
10111012
1012−instance OVERLAPPING_
1013+instance INCOHERENT_
10131014 ( Selector s
10141015 , GToJSON enc arity (K1 i (Maybe a))
10151016 , GKeyValue enc pairs
tests/Encoders.hs+5
@@ -252,6 +252,11 @@ incoherentInstancesNeededParseJSONString :: FromJSON a => Value -> Parser (Incoh
252252incoherentInstancesNeededParseJSONString = case () of
253253 _ | True -> $(mkParseJSON defaultOptions ''IncoherentInstancesNeeded)
254254 | False -> genericParseJSON defaultOptions
255+
256+incoherentInstancesNeededToJSON :: ToJSON a => IncoherentInstancesNeeded a -> Value
257+incoherentInstancesNeededToJSON = case () of
258+ _ | True -> $(mkToJSON defaultOptions ''IncoherentInstancesNeeded)
259+ | False -> genericToJSON defaultOptions
255260#endif
256261
257262-------------------------------------------------------------------------------