From b3bbff3f45e62d44dfcafbd686b735ae6ad34f6d Mon Sep 17 00:00:00 2001 From: joshvera Date: Mon, 23 Jan 2017 17:46:29 -0500 Subject: [PATCH] Output term, category, sourceSpan --- src/Renderer/TOC.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Renderer/TOC.hs b/src/Renderer/TOC.hs index bdcd7194e..62bc8d6e0 100644 --- a/src/Renderer/TOC.hs +++ b/src/Renderer/TOC.hs @@ -59,7 +59,10 @@ data JSONSummary = JSONSummary { info :: ParentInfo, changeType :: Text } instance ToJSON JSONSummary where -- TODO fix JSON instance - toJSON JSONSummary{..} = object [ "changeType" .= changeType ] + toJSON JSONSummary{..} = object . ([ "changeType" .= changeType ] <>) $ case info of + ParentInfo{..} -> [ "category" .= (show parentCategory :: Text), "term" .= parentTermName, "sourceSpan" .= parentSourceSpan ] + ExpressionInfo{..} -> [ "category" .= (show exprCategory :: Text), "term" .= exprTermName, "sourceSpan" .= exprSourceSpan ] + None -> [] toJSON ErrorSummary{..} = object [ "error" .= error, "span" .= errorSpan ] isErrorSummary :: JSONSummary -> Bool