From 5385069ace5d618874c7c8712e71af0f5dcf8bd9 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Thu, 25 Jan 2018 11:15:10 -0800 Subject: [PATCH] s/ModuleSummary/ImportSummary --- src/Rendering/Imports.hs | 20 ++++++++++---------- src/Rendering/Renderer.hs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Rendering/Imports.hs b/src/Rendering/Imports.hs index 63a348ca7..120f1a6ce 100644 --- a/src/Rendering/Imports.hs +++ b/src/Rendering/Imports.hs @@ -1,7 +1,7 @@ {-# LANGUAGE DataKinds, MultiParamTypeClasses, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} module Rendering.Imports ( renderToImports -, ModuleSummary(..) +, ImportSummary(..) ) where import Analysis.Declaration @@ -23,20 +23,20 @@ import qualified Data.Map as Map import Rendering.TOC (termTableOfContentsBy, declaration, getDeclaration, toCategoryName) -newtype ModuleSummary = ModuleSummary (Map.Map T.Text Module) deriving (Eq, Show) +newtype ImportSummary = ImportSummary (Map.Map T.Text Module) deriving (Eq, Show) -instance Monoid ModuleSummary where - mempty = ModuleSummary mempty - mappend (ModuleSummary m1) (ModuleSummary m2) = ModuleSummary (Map.unionWith (<>) m1 m2) +instance Monoid ImportSummary where + mempty = ImportSummary mempty + mappend (ImportSummary m1) (ImportSummary m2) = ImportSummary (Map.unionWith (<>) m1 m2) -instance Output ModuleSummary where +instance Output ImportSummary where toOutput = toStrict . (<> "\n") . encodePretty' defConfig { confCompare = compare, confIndent = Spaces 2 } -instance ToJSON ModuleSummary where - toJSON (ModuleSummary m) = object [ "modules" .= m ] +instance ToJSON ImportSummary where + toJSON (ImportSummary m) = object [ "modules" .= m ] -renderToImports :: (HasField fields (Maybe ModuleDef), HasField fields (Maybe Declaration), HasField fields Span, Foldable f, Functor f) => Blob -> Term f (Record fields) -> ModuleSummary -renderToImports blob term = ModuleSummary $ toMap (termToModule blob term) +renderToImports :: (HasField fields (Maybe ModuleDef), HasField fields (Maybe Declaration), HasField fields Span, Foldable f, Functor f) => Blob -> Term f (Record fields) -> ImportSummary +renderToImports blob term = ImportSummary $ toMap (termToModule blob term) where toMap m@Module{..} = Map.singleton moduleName m termToModule :: (HasField fields (Maybe ModuleDef), HasField fields (Maybe Declaration), HasField fields Span, Foldable f, Functor f) => Blob -> Term f (Record fields) -> Module diff --git a/src/Rendering/Renderer.hs b/src/Rendering/Renderer.hs index 08309fbd4..cace69334 100644 --- a/src/Rendering/Renderer.hs +++ b/src/Rendering/Renderer.hs @@ -13,7 +13,7 @@ module Rendering.Renderer , renderToCTerm , renderSymbolTerms , renderToSymbols -, ModuleSummary(..) +, ImportSummary(..) , renderToImports , renderToTags , renderDOTDiff @@ -58,7 +58,7 @@ data TermRenderer output where -- | Render to a list of symbols. SymbolsTermRenderer :: SymbolFields -> TermRenderer [Value] -- | Render to a list of modules that represent the import graph. - ImportsTermRenderer :: TermRenderer ModuleSummary + ImportsTermRenderer :: TermRenderer ImportSummary -- | Render to a 'ByteString' formatted as a DOT description of the term. DOTTermRenderer :: TermRenderer ByteString