aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/App.hs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index d9f92335c..4c4525dce 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-
Copyright (C) 2006-2017 John MacFarlane <jgm@berkeley.edu>
@@ -44,8 +45,8 @@ import qualified Control.Exception as E
import Control.Monad
import Control.Monad.Except (catchError, throwError)
import Control.Monad.Trans
-import Data.Aeson (FromJSON (..), ToJSON (..), defaultOptions, eitherDecode',
- encode, genericToEncoding)
+import Data.Aeson (defaultOptions, eitherDecode', encode)
+import Data.Aeson.TH (deriveJSON)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as B
import Data.Char (toLower, toUpper)
@@ -95,10 +96,6 @@ import System.Posix.Terminal (queryTerminal)
data LineEnding = LF | CRLF | Native deriving (Show, Generic)
-instance ToJSON LineEnding where
- toEncoding = genericToEncoding defaultOptions
-instance FromJSON LineEnding
-
parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
parseOptions options' defaults = do
rawArgs <- map UTF8.decodeArg <$> getArgs
@@ -646,10 +643,6 @@ data Opt = Opt
, optStripComments :: Bool -- ^ Skip HTML comments
} deriving (Generic, Show)
-instance ToJSON Opt where
- toEncoding = genericToEncoding defaultOptions
-instance FromJSON Opt
-
-- | Defaults for command-line options.
defaultOpts :: Opt
defaultOpts = Opt
@@ -1677,3 +1670,6 @@ deprecatedOption o =
\r -> case r of
Right () -> return ()
Left e -> E.throwIO e
+
+$(deriveJSON defaultOptions ''LineEnding)
+$(deriveJSON defaultOptions ''Opt)