From 8c61fe8d6ab59716640e298a59737ff1eb1156ea Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 5 Nov 2018 15:06:14 -0800 Subject: Use DERIVE_JSON_VIA_TH in Text.Pandoc.Filter. Previously AVOID_TEMPLATE_HASKELL was used (with the opposite valence). I assume this was a leftover from an earlier version. --- src/Text/Pandoc/Filter.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Filter.hs b/src/Text/Pandoc/Filter.hs index 5f8a9fdee..df80d4c82 100644 --- a/src/Text/Pandoc/Filter.hs +++ b/src/Text/Pandoc/Filter.hs @@ -38,11 +38,11 @@ module Text.Pandoc.Filter ) where import Prelude -#ifdef AVOID_TEMPLATE_HASKELL +#ifdef DERIVE_JSON_VIA_TH +import Data.Aeson.TH (deriveJSON, defaultOptions) +#else import Data.Aeson (FromJSON (..), ToJSON (..), defaultOptions, genericToEncoding) -#else -import Data.Aeson.TH (deriveJSON, defaultOptions) #endif import Data.Foldable (foldrM) import GHC.Generics (Generic) @@ -76,10 +76,10 @@ expandFilterPath :: Filter -> PandocIO Filter expandFilterPath (LuaFilter fp) = LuaFilter <$> Path.expandFilterPath fp expandFilterPath (JSONFilter fp) = JSONFilter <$> Path.expandFilterPath fp -#ifdef AVOID_TEMPLATE_HASKELL +#ifdef DERIVE_JSON_VIA_TH +$(deriveJSON defaultOptions ''Filter) +#else instance ToJSON Filter where toEncoding = genericToEncoding defaultOptions instance FromJSON Filter -#else -$(deriveJSON defaultOptions ''Filter) #endif -- cgit v1.2.3