Skip to content

fix(testing): haskell ground truth now recognizes point-free functions - #1581

Merged
squid-protocol merged 1 commit into
mainfrom
fix/1566-haskell-bind-node-ground-truth
Aug 14, 2026
Merged

fix(testing): haskell ground truth now recognizes point-free functions#1581
squid-protocol merged 1 commit into
mainfrom
fix/1566-haskell-bind-node-ground-truth

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • tree_sitter_accuracy_audit.py's haskell NODE_MAPS only counted "function" nodes for 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 on having a paired arrow-typed "signature" sibling (unwrapping typeclass-context/forall wrappers 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_count mirrors detector.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.
  • 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

Test plan

  • Verified gating/arity logic on synthetic cases (plain point-free, curried multi-arrow, typeclass-constrained, forall-quantified, arrow-free type, untyped local) directly against tree_sitter_language_pack
  • python tests/tools/tree_sitter_accuracy_audit.py --lang haskell — baseline regenerated, numbers above
  • python tests/tools/tree_sitter_accuracy_audit.py --all --ci — all 31 languages pass, no other language affected

🤖 Generated with Claude Code

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>
@squid-protocol
squid-protocol merged commit e6a70aa into main Aug 14, 2026
26 of 27 checks passed
@squid-protocol
squid-protocol deleted the fix/1566-haskell-bind-node-ground-truth branch August 14, 2026 14:28
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tree_sitter_accuracy_audit: haskell NODE_MAPS excludes tree-sitter's bind node, undercounting point-free functions as false positives

1 participant