diff --git a/src/Parsing/Parser.hs b/src/Parsing/Parser.hs index d4dd82b69..5341fe54a 100644 --- a/src/Parsing/Parser.hs +++ b/src/Parsing/Parser.hs @@ -17,44 +17,45 @@ module Parsing.Parser , phpParser ) where -import Prologue -import Assigning.Assignment +import Assigning.Assignment import qualified CMarkGFM -import Data.AST -import Data.Kind -import Data.Language -import Data.Record +import Data.AST +import Data.Kind +import Data.Language +import Data.Record import qualified Data.Syntax as Syntax -import Data.Term -import Foreign.Ptr +import Data.Term +import Foreign.Ptr +import qualified GHC.TypeLits as TypeLevel import qualified Language.Go.Assignment as Go import qualified Language.JSON.Assignment as JSON import qualified Language.Markdown.Assignment as Markdown +import qualified Language.PHP.Assignment as PHP +import Language.Preluded import qualified Language.Python.Assignment as Python import qualified Language.Ruby.Assignment as Ruby import qualified Language.TypeScript.Assignment as TypeScript -import qualified Language.PHP.Assignment as PHP +import Prologue +import TreeSitter.Go +import TreeSitter.JSON import qualified TreeSitter.Language as TS (Language, Symbol) -import TreeSitter.Go -import TreeSitter.JSON -import TreeSitter.PHP -import TreeSitter.Python -import TreeSitter.Ruby -import TreeSitter.TypeScript -import qualified GHC.TypeLits as TypeLevel -import Language.Preluded +import TreeSitter.PHP +import TreeSitter.Python +import TreeSitter.Ruby +import TreeSitter.TypeScript type family ApplyAll' (typeclasses :: [(* -> *) -> Constraint]) (fs :: [* -> *]) :: Constraint where ApplyAll' (typeclass ': typeclasses) fs = (Apply typeclass fs, ApplyAll' typeclasses fs) ApplyAll' '[] fs = () +-- | A parser, suitable for program analysis, for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints. data SomeAnalysisParser typeclasses ann where SomeAnalysisParser :: ( Member Syntax.Identifier fs , ApplyAll' typeclasses fs) - => Parser (Term (Union fs) ann) - -> [String] - -> Maybe String + => Parser (Term (Union fs) ann) -- ^ A parser. + -> [String] -- ^ List of valid file extensions to be used for module resolution. + -> Maybe String -- ^ Maybe path to prelude. -> SomeAnalysisParser typeclasses ann -- | A parser for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints. diff --git a/src/Rendering/Renderer.hs b/src/Rendering/Renderer.hs index 7204ed132..2118f3e2b 100644 --- a/src/Rendering/Renderer.hs +++ b/src/Rendering/Renderer.hs @@ -66,7 +66,7 @@ data TermRenderer output where deriving instance Eq (TermRenderer output) deriving instance Show (TermRenderer output) - +-- | Specification of renderers for graph analysis, producing output in the parameter type. data GraphRenderer output where JSONGraphRenderer :: GraphRenderer ByteString DOTGraphRenderer :: GraphRenderer ByteString @@ -76,7 +76,7 @@ deriving instance Show (GraphRenderer output) -- | Abstraction of some renderer to some 'Monoid'al output which can be serialized to a 'ByteString'. -- --- This type abstracts the type indices of 'DiffRenderer' and 'TermRenderer' s.t. multiple renderers can be present in a single list, alternation, etc., while retaining the ability to render and serialize. (Without 'SomeRenderer', the different output types of individual term/diff renderers prevent them from being used in a homogeneously typed setting.) +-- This type abstracts the type indices of 'DiffRenderer', 'TermRenderer', and 'GraphRenderer' s.t. multiple renderers can be present in a single list, alternation, etc., while retaining the ability to render and serialize. (Without 'SomeRenderer', the different output types of individual term/diff renderers prevent them from being used in a homogeneously typed setting.) data SomeRenderer f where SomeRenderer :: (Output output, Show (f output)) => f output -> SomeRenderer f