Remove CPP instances

pull/357/head
Taylor Fausak 2021-11-06 17:09:43 +00:00 committed by GitHub
parent 56ccbc91a8
commit 19a092b862
1 changed files with 58 additions and 41 deletions

View File

@ -36,56 +36,73 @@ aesonDecodeOptionsBrittany = Aeson.defaultOptions
, Aeson.fieldLabelModifier = dropWhile (=='_') , Aeson.fieldLabelModifier = dropWhile (=='_')
} }
#define makeFromJSON(type)\ instance FromJSON (CDebugConfig Maybe) where
instance FromJSON (type) where\ parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany;\
{-# NOINLINE parseJSON #-}
#define makeToJSON(type)\
instance ToJSON (type) where\
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany;\
{-# NOINLINE toJSON #-};\
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany;\
{-# NOINLINE toEncoding #-}
#define makeFromJSONMaybe(type)\ instance ToJSON (CDebugConfig Maybe) where
instance FromJSON (type Maybe) where\ toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany;\
{-# NOINLINE parseJSON #-}
#define makeToJSONMaybe(type)\
instance ToJSON (type Maybe) where\
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany;\
{-# NOINLINE toJSON #-};\
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany;\
{-# NOINLINE toEncoding #-}
instance FromJSON IndentPolicy where
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
makeFromJSONMaybe(CDebugConfig) instance ToJSON IndentPolicy where
makeToJSONMaybe(CDebugConfig) toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany
makeFromJSON(IndentPolicy) instance FromJSON AltChooser where
makeToJSON(IndentPolicy) parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
makeFromJSON(AltChooser)
makeToJSON(AltChooser)
makeFromJSON(ColumnAlignMode)
makeToJSON(ColumnAlignMode)
makeFromJSON(CPPMode)
makeToJSON(CPPMode)
makeFromJSON(ExactPrintFallbackMode)
makeToJSON(ExactPrintFallbackMode)
makeFromJSONMaybe(CLayoutConfig) instance ToJSON AltChooser where
makeToJSONMaybe(CLayoutConfig) toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany
makeFromJSONMaybe(CErrorHandlingConfig) instance FromJSON ColumnAlignMode where
makeToJSONMaybe(CErrorHandlingConfig) parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
makeFromJSONMaybe(CForwardOptions) instance ToJSON ColumnAlignMode where
makeToJSONMaybe(CForwardOptions) toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany
makeFromJSONMaybe(CPreProcessorConfig) instance FromJSON CPPMode where
makeToJSONMaybe(CPreProcessorConfig) parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
makeToJSONMaybe(CConfig) instance ToJSON CPPMode where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany
instance FromJSON ExactPrintFallbackMode where
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
instance ToJSON ExactPrintFallbackMode where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
toEncoding = Aeson.genericToEncoding aesonDecodeOptionsBrittany
instance FromJSON (CLayoutConfig Maybe) where
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
instance ToJSON (CLayoutConfig Maybe) where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
instance FromJSON (CErrorHandlingConfig Maybe) where
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
instance ToJSON (CErrorHandlingConfig Maybe) where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
instance FromJSON (CForwardOptions Maybe) where
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
instance ToJSON (CForwardOptions Maybe) where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
instance FromJSON (CPreProcessorConfig Maybe) where
parseJSON = Aeson.genericParseJSON aesonDecodeOptionsBrittany
instance ToJSON (CPreProcessorConfig Maybe) where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
instance ToJSON (CConfig Maybe) where
toJSON = Aeson.genericToJSON aesonDecodeOptionsBrittany
-- This custom instance ensures the "omitNothingFields" behaviour not only for -- This custom instance ensures the "omitNothingFields" behaviour not only for
-- leafs, but for nodes of the config as well. This way e.g. "{}" is valid -- leafs, but for nodes of the config as well. This way e.g. "{}" is valid