Repository navigation
Description
Summary
A local binding whose defining equation puts its guards (| cond = expr) on separate, more-indented lines — with no = anywhere on the line that introduces the name and its pattern — is never matched by func_start. This is a distinct shape from #1615 (single-line where): here where/let is on its own line (or absent), but the name+pattern line itself has no = at all.
Root Cause
func_start's equation-anchored alternative requires an = on the SAME line as the captured name, via the trailing lookahead (?=[ \t]+[^\s=][^\n=]*(?<![!<>/])=(?![=>])) (the [^\n=]* is explicitly bounded to the current line). Idiomatic Haskell routinely omits the = from the naming line entirely when the equation uses guards instead of a bare RHS:
isAllowedPunct c
| extensionEnabled Ext_gfm_auto_identifiers exts = c == '-' || c == '_' || ...
| otherwise = c == '_' || c == '-' || c == '.'isAllowedPunct c (the naming/pattern line) has no = on it — the = only appears on the guard lines below — so the lookahead never has anything to match on that line, and the whole definition is invisible.
Verification
Confirmed real-world misses in the pinned language-crucible/data/haskell/pandoc corpus (found via the clause-collapsed recall check in #1614 — these are genuine misses, not clause-counting artifacts):
isAllowedPunct(Shared.hs:500) —isAllowedPunct cthen two|-guard linesstripBeginSpace(Shared.hs:202, nestedwhereinsidetrimMath) —stripBeginSpace tthen three|-guard linesensureNl(App.hs:329) —let ensureNl tthen three|-guard lines (also combines with theletshape, butletalone is already skippable via haskell func_start: single-linelet name args = exprlocal bindings are structurally invisible #1564 — the guard-only naming line is the actual blocker here)adjustNum(Shared.hs:535) —let adjustNum lev numComponentthen three|-guard lines (same combination asensureNl)
Proposed Fix
Extend the equation-anchored alternative to also recognize a naming/pattern line with no = when it's immediately followed by one or more indented guard lines (| ... = ...) at a deeper indent, ending the block at the first line that dedents back to the naming line's own indent (same dedent-scan mechanism _slice_by_indentation already uses elsewhere) — analogous in spirit to #1435's fix for bodyless typeclass method signatures (also a "no = on the anchoring line" shape, there because the definition doesn't exist yet rather than because of guards).
Important: This is a detector.py/language_standards.py regex change and needs the Differential Scan protocol (crucible_check.py) before merging per CLAUDE.md.
Related Work
- tree_sitter_accuracy_audit: haskell ground truth counts each pattern-match clause as a separate real function, deflating measured func_start recall from ~94% to 50.5% #1614 (audit-tool ground-truth clause-collapsing bug — this issue's misses were isolated using that investigation)
- haskell func_start: single-line
where name args = exprlocal bindings are structurally invisible #1615 (sibling issue: single-linewhere name args = exprgap, found in the same investigation) - haskell func_start: hardcoded '< 2 lines' floor in _slice_by_indentation drops every abstract typeclass method signature #1435 (closed) — related "no
=on the anchor line" shape, different cause (bodyless signatures) - haskell func_start: typeclass instance methods and where-clause locals without an explicit '::' signature are structurally invisible #1442, haskell func_start: single-line
let name args = exprlocal bindings are structurally invisible #1564 (closed) — other haskell func_start local-binding gaps
Activity
docs: correct Claim 4 numbers to match the shipped #1614 fix (#1618)
docs: log Claim 4 (haskell multi-clause function counting) in beats-A…
fix(haskell): use a scope-aware stack for multi-clause dedup, not one…
fix(haskell): let func_start/args match guard-only defining equations (…