From edce81734e3ba80773920dafd5bb60c3528fbacd Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 28 Jun 2018 17:38:58 +0200 Subject: Avoid using deprecated 'decode' from yaml. --- src/Text/Pandoc/App.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 093f0fcfc..f2b7ab7a3 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -62,7 +62,7 @@ import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TE import qualified Data.Text.Encoding.Error as TE -import Data.Yaml (decode) +import Data.Yaml (decodeEither) import qualified Data.Yaml as Yaml import GHC.Generics import Network.URI (URI (..), parseURI) @@ -702,10 +702,10 @@ removeMetaKeys :: [(String,String)] -> Pandoc -> Pandoc removeMetaKeys kvs pdc = foldr (deleteMeta . fst) pdc kvs readMetaValue :: String -> MetaValue -readMetaValue s = case decode (UTF8.fromString s) of - Just (Yaml.String t) -> MetaString $ T.unpack t - Just (Yaml.Bool b) -> MetaBool b - _ -> MetaString s +readMetaValue s = case decodeEither (UTF8.fromString s) of + Right (Yaml.String t) -> MetaString $ T.unpack t + Right (Yaml.Bool b) -> MetaBool b + _ -> MetaString s -- Determine default reader based on source file extensions defaultReaderName :: String -> [FilePath] -> String -- cgit v1.2.3