From 59735e5dacb6baa3e140d649ebddb804897dff53 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 27 Apr 2017 19:13:18 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20pass=20the=20debug=20flags=20to?= =?UTF-8?q?=20the=20renderers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Renderer.hs | 4 ++-- src/Renderer/JSON.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Renderer.hs b/src/Renderer.hs index a608a5b46..7f472a313 100644 --- a/src/Renderer.hs +++ b/src/Renderer.hs @@ -59,8 +59,8 @@ data ParseTreeRenderer fields output where resolveParseTreeRenderer :: (Monoid output, StringConv output ByteString) => ParseTreeRenderer fields output -> SourceBlob -> Term (Syntax Text) (Record fields) -> output resolveParseTreeRenderer renderer = case renderer of SExpressionParseTreeRenderer format -> R.sExpressionParseTree format - JSONParseTreeRenderer debug -> R.jsonParseTree debug - JSONIndexParseTreeRenderer debug -> R.jsonIndexParseTree debug + JSONParseTreeRenderer debug -> R.jsonParseTree + JSONIndexParseTreeRenderer debug -> R.jsonIndexParseTree runParseTreeRenderer :: (Monoid output, StringConv output ByteString) => ParseTreeRenderer fields output -> [(SourceBlob, Term (Syntax Text) (Record fields))] -> output runParseTreeRenderer = foldMap . uncurry . resolveParseTreeRenderer diff --git a/src/Renderer/JSON.hs b/src/Renderer/JSON.hs index 081b8b541..51ff340fc 100644 --- a/src/Renderer/JSON.hs +++ b/src/Renderer/JSON.hs @@ -203,11 +203,11 @@ newtype Identifier = Identifier { unIdentifier :: Text } instance ToJSONFields Identifier where toJSONFields (Renderer.JSON.Identifier i) = ["identifier" .= i] -jsonParseTree :: ToJSONFields (Record fields) => Bool -> SourceBlob -> Term (Syntax Text) (Record fields) -> Value -jsonParseTree _ SourceBlob{..} = toJSON . File path . decoratorWithAlgebra (fToR identifierAlg) +jsonParseTree :: ToJSONFields (Record fields) => SourceBlob -> Term (Syntax Text) (Record fields) -> Value +jsonParseTree SourceBlob{..} = toJSON . File path . decoratorWithAlgebra (fToR identifierAlg) -jsonIndexParseTree :: ToJSONFields (Record fields) => Bool -> SourceBlob -> Term (Syntax Text) (Record fields) -> Value -jsonIndexParseTree _ SourceBlob{..} = toJSON . File path . fmap (object . toJSONFields) . cata combine . decoratorWithAlgebra (fToR identifierAlg) +jsonIndexParseTree :: ToJSONFields (Record fields) => SourceBlob -> Term (Syntax Text) (Record fields) -> Value +jsonIndexParseTree SourceBlob{..} = toJSON . File path . fmap (object . toJSONFields) . cata combine . decoratorWithAlgebra (fToR identifierAlg) where combine (a :< f) | Nothing <- rhead a = Prologue.concat f | Leaf _ <- f = Prologue.concat f | otherwise = a : Prologue.concat f