aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-06-28 17:38:58 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2018-06-28 17:38:58 +0200
commitedce81734e3ba80773920dafd5bb60c3528fbacd (patch)
tree20232bc33b911040a9f2f9d5d7bb72257521d055
parent7b3cc7d1a9e4bd677d8d86ffff25e996d7bc4442 (diff)
downloadpandoc-edce81734e3ba80773920dafd5bb60c3528fbacd.tar.gz
Avoid using deprecated 'decode' from yaml.
-rw-r--r--src/Text/Pandoc/App.hs10
1 files changed, 5 insertions, 5 deletions
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