You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It occurred to me that Language, Parser, etc. could have a (phantom) type parameter for the AST they relate to:
-- in TreeSitter.LanguagedataLanguagea-- in the internal moduleforeignimport ccall unsafe"vendor/tree-sitter-python/src/parser.c tree_sitter_python" tree_sitter_python ::Ptr (Languagea)
-- in the public moduleimportqualifiedTreeSitter.Python.ASTasASTimportqualifiedTreeSitter.Python.InternalasInternalpython::Ptr (Language (AST.Modulea))
python =Internal.tree_sitter_python
-- in TreeSitter.UnmarshalparseByteString::Unmarshalt=>Ptr (TS.Languaget) ->ByteString->IO (EitherStringt)
This would be a pretty big usability improvement for parseByteString, which otherwise can’t generally infer the type of t.
We might want to index it by the grammar type as well:
It occurred to me that
Language
,Parser
, etc. could have a (phantom) type parameter for the AST they relate to:This would be a pretty big usability improvement for
parseByteString
, which otherwise can’t generally infer the type oft
.We might want to index it by the grammar type as well:
as that would then allow us to index
Tree
&Node
by theGrammar
type, making it much easier to work with their symbols.The text was updated successfully, but these errors were encountered: