Repository navigation
Description
Summary
This is a bug in tests/tools/tree_sitter_accuracy_audit.py's ground truth for Haskell, not in GitGalaxy's engine — same class of issue as already-fixed #1505 and #1511. The audit tool's NODE_MAPS is missing tree-sitter-haskell's bind node type, causing point-free function definitions to be systematically undercounted as false positives (alleged "extra" detections by GitGalaxy).
Root Cause
NODE_MAPS["haskell"]["func_node_types"] = {"function"} (line ~387) only includes function nodes. However, tree-sitter-haskell's grammar puts point-free function definitions — i.e. name :: A -> B followed by name = expr with no explicit argument patterns — under a bind node, not a function node, even though the type signature has an arrow and the value is unambiguously a function by any practical definition.
Verified by parsing a minimal snippet directly:
- Point-free
name = exprproduces:signature(withfunctiontype inside it, i.e. the type-signature node) + a top-levelbindnode containingvariable+match - Explicit-pattern
name arg = exprproduces: a top-levelfunctionnode
Impact
Because func_node_types only includes "function", every point-free definition in the corpus is invisible to the real_functions ground truth set:
- Ground truth itself undercounts real functions
- GitGalaxy's correct detection of these (regex already requires an arrow in the type signature before counting as a function, per haskell func_start matches point-free VALUE bindings (no arrow in type) as if they were functions #1312 fix) is scored as a false-positive "extra"
This artificially depresses Haskell's measured func_recall / func_precision in docs/self_scan/tree_sitter_accuracy_history.csv (currently worst of any language at ~42% recall / ~76% precision) — true numbers are meaningfully better once point-free functions are counted correctly.
Verification
On the pinned language-crucible/data/haskell/pandoc corpus, roughly 25 of the ~31 reported "extra" (alleged false-positive) names are point-free definitions with arrow-containing type signatures.
Confirmed examples (all real point-free function definitions):
trim(Shared.hs:177,trim :: T.Text -> T.Text; trim = T.dropAround isWS)triml(Shared.hs:181)trimr(Shared.hs:195)stringify(Shared.hs:363-364)capitalize(Shared.hs:396-397)tshow(Shared.hs:170-171)removeFormatting(Shared.hs:344-345)collapseFilePath(Shared.hs:765-766)hasLineBreaks(Shared.hs:614-615)combineLines(Shared.hs:438-439)- And more in the same file
Fix Direction
- Add
"bind"to haskell'sfunc_node_typesin NODE_MAPS - Update the node's name-getter (
_get_node_name) to correctly extract thevariablefield's name from abindnode the same way it does forfunctionnodes - Important: The walk should only count a
bindnode as a real function if there's a pairedsignaturenode with afunction-typed (arrow-containing) signature for the same name, to avoid flipping the problem into over-counting true non-function value bindings (this mirrors the exact reasoning haskell func_start matches point-free VALUE bindings (no arrow in type) as if they were functions #1312 already applied on the GitGalaxy-regex side of the same distinction)
Related Work
- Haskell: detector.py's start_line looks shifted by roughly one prior function when short definitions are stacked #1532 (open)
- haskell args regex: signature-less equations measure 0, and qualified/dotted types truncate the :: signature capture #1511 (closed) — similar audit-tool NODE_MAPS fix
- tree_sitter_accuracy_audit: haskell's _get_param_count never finds parameters (equation node's pattern list field is 'patterns', not 'parameters') #1505 (closed) — similar audit-tool NODE_MAPS fix
- haskell func_start: typeclass instance methods and where-clause locals without an explicit '::' signature are structurally invisible #1442 (closed)
- haskell func_start: hardcoded '< 2 lines' floor in _slice_by_indentation drops every abstract typeclass method signature #1435 (closed)
- haskell func_start matches point-free VALUE bindings (no arrow in type) as if they were functions #1312 (closed)
Activity
Validate haskell ctags-alone-existence ledger entry
Fix haskell clause-splitting in tri-comparison's tree-sitter walk (#1865
Tri-comparison chart: drop recall/args ratios for unranked found-coun…
Resolve all 6 rust tri-comparison ledger shapes (#1873)