fix(testing): haskell ground truth now recognizes point-free functions - #1581
Merged
Merged
Conversation
tree_sitter_accuracy_audit.py's NODE_MAPS only counted "function" nodes for haskell real_functions, but tree-sitter-haskell parses point-free definitions (name :: A -> B; name = expr, no explicit argument patterns) as a "bind" node instead -- a real function per its type signature, just structurally invisible to the audit before this. Adds "bind" to func_node_types, gated in _get_node_name on having a paired arrow-typed "signature" sibling (unwrapping typeclass-context and forall wrappers first) so genuine non-function value bindings still aren't counted -- same reasoning GitGalaxy's own regex already applies via #1312. _get_param_count mirrors detector.py's own _count_haskell_type_arrows (#1209) for the arrow-chain arity so both sides of the comparison read the same signal. On the pinned pandoc corpus: extra_functions 33 -> 7, found_functions 104 -> 130, args_exact_match 94 -> 120. Precision rises from 75.9% to 94.9%. Fixes #1566 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tree_sitter_accuracy_audit.py's haskellNODE_MAPSonly counted"function"nodes forreal_functions, but tree-sitter-haskell parses point-free definitions (name :: A -> B; name = expr, no explicit argument patterns) as a"bind"node instead — a real function per its type signature, just structurally invisible to the audit before this."bind"tofunc_node_types, gated on having a paired arrow-typed"signature"sibling (unwrapping typeclass-context/forallwrappers first) so genuine non-function value bindings still aren't counted — same reasoning GitGalaxy's own regex already applies via haskell func_start matches point-free VALUE bindings (no arrow in type) as if they were functions #1312._get_param_countmirrorsdetector.py's own_count_haskell_type_arrows(fix(core): args regex capture group missing in 25 languages (regression from #1199 Python fix) #1209) for the arrow-chain arity so both sides read the same signal.extra_functions33 → 7,found_functions104 → 130,args_exact_match94 → 120. Precision rises from 75.9% to 94.9%.Fixes #1566
Test plan
forall-quantified, arrow-free type, untyped local) directly againsttree_sitter_language_packpython tests/tools/tree_sitter_accuracy_audit.py --lang haskell— baseline regenerated, numbers abovepython tests/tools/tree_sitter_accuracy_audit.py --all --ci— all 31 languages pass, no other language affected🤖 Generated with Claude Code