From 4c3db9273fc8e92c2c23d4455a6ab178472be06d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 7 Feb 2020 08:32:47 -0800 Subject: Apply linter suggestions. Add fix_spacing to lint target in Makefile. --- src/Text/Pandoc/Readers/Metadata.hs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/Text/Pandoc/Readers/Metadata.hs') diff --git a/src/Text/Pandoc/Readers/Metadata.hs b/src/Text/Pandoc/Readers/Metadata.hs index 701e65980..23ceb40f9 100644 --- a/src/Text/Pandoc/Readers/Metadata.hs +++ b/src/Text/Pandoc/Readers/Metadata.hs @@ -40,8 +40,8 @@ yamlBsToMeta :: PandocMonad m yamlBsToMeta pBlocks bstr = do pos <- getPosition case YAML.decodeNode' YAML.failsafeSchemaResolver False False bstr of - Right ((YAML.Doc (YAML.Mapping _ _ o)):_) - -> (fmap Meta) <$> yamlMap pBlocks o + Right (YAML.Doc (YAML.Mapping _ _ o):_) + -> fmap Meta <$> yamlMap pBlocks o Right [] -> return . return $ mempty Right [YAML.Doc (YAML.Scalar _ YAML.SNull)] -> return . return $ mempty @@ -84,12 +84,10 @@ toMetaValue pBlocks x = asBlocks p = MetaBlocks . B.toList <$> p checkBoolean :: Text -> Maybe Bool -checkBoolean t = - if t == T.pack "true" || t == T.pack "True" || t == T.pack "TRUE" - then Just True - else if t == T.pack "false" || t == T.pack "False" || t == T.pack "FALSE" - then Just False - else Nothing +checkBoolean t + | t == T.pack "true" || t == T.pack "True" || t == T.pack "TRUE" = Just True + | t == T.pack "false" || t == T.pack "False" || t == T.pack "FALSE" = Just False + | otherwise = Nothing yamlToMetaValue :: PandocMonad m => ParserT Text ParserState m (F Blocks) @@ -133,4 +131,3 @@ yamlMap pBlocks o = do return $ do v' <- fv return (k, v') - -- cgit v1.2.3