diff --git a/src/Parser.hs b/src/Parser.hs index e0b019d82..7bf3182a0 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -41,7 +41,7 @@ import TreeSitter -- | A parser from 'Source' onto some term type. data Parser term where -- | A parser producing 'AST' using a 'TS.Language'. - ASTParser :: (Bounded grammar, Enum grammar) => Ptr TS.Language -> Parser (Cofree [] (Record (grammar ': Location))) + ASTParser :: (Bounded grammar, Enum grammar) => Ptr TS.Language -> Parser (AST grammar) -- | A parser producing an à la carte term given an 'AST'-producing parser and an 'Assignment' onto 'Term's in some syntax type. Assignment errors will result in a top-level 'Syntax.Error' node. AssignmentParser :: (Enum grammar, Eq grammar, Show grammar, Symbol grammar, Syntax.Error (Error grammar) :< fs, Foldable (Union fs), Functor (Union fs), Recursive ast, Foldable (Base ast)) => Parser ast -- ^ A parser producing AST. diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index f783156a8..2666206e0 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -41,7 +41,7 @@ treeSitterParser language grammar source = bracket ts_document_new ts_document_f -- | Parse 'Source' with the given 'TS.Language' and return its AST. -parseToAST :: (Bounded grammar, Enum grammar) => Ptr TS.Language -> Source -> IO (Cofree [] (Record (grammar ': A.Location))) +parseToAST :: (Bounded grammar, Enum grammar) => Ptr TS.Language -> Source -> IO (A.AST grammar) parseToAST language source = bracket ts_document_new ts_document_free $ \ document -> do ts_document_set_language document language root <- unsafeUseAsCStringLen (sourceBytes source) $ \ (source, len) -> do @@ -53,7 +53,7 @@ parseToAST language source = bracket ts_document_new ts_document_free $ \ docume anaM toAST root -toAST :: (Bounded grammar, Enum grammar) => Node -> IO (CofreeF [] (Record (grammar ': A.Location)) Node) +toAST :: (Bounded grammar, Enum grammar) => Node -> IO (Base (A.AST grammar) Node) toAST node@Node{..} = do let count = fromIntegral nodeChildCount children <- allocaArray count $ \ childNodesPtr -> do