Repository navigation
Description
Summary
A where-introduced local binding whose first clause is written entirely on one line — where name args = expr — is never matched by func_start. This is the exact same shape #1564 already fixed for let, just not yet extended to where.
Root Cause
func_start's equation-anchored alternative (gitgalaxy/standards/language_standards.py, haskell) is:
^[ \t]+(?:let[ \t]+)?(?!(?:case|class|data|default|deriving|do|else|foreign|if|import|in|infix|infixl|infixr|instance|let|mdo|module|newtype|of|then|type|where)\b)([a-z_][a-zA-Z0-9_']*)(?=[ \t]+[^\s=][^\n=]*(?<![!<>/])=(?![=>]))
The (?:let[ \t]+)? optional skip added by #1564 lets a same-line let name args = expr anchor past the let token. where gets no equivalent skip — when a line reads where name args = expr (the binding's first/only clause written on the same physical line as the where keyword itself, rather than where alone with the binding starting on the next line), the negative lookahead's keyword exclusion sees where immediately after ^[ \t]+ and rejects the whole line, with no way to retry past it the way let now can.
Verification
Tested the regex directly:
from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS
fs = LANGUAGE_DEFINITIONS['haskell']['rules']['func_start']
snippet = """
renderTags' :: [Tag T.Text] -> T.Text
renderTags' = renderTagsOptions
renderOptions{ optMinimize = matchTags ["hr"] }
where matchTags tags = flip elem tags . T.toLower
"""
list(fs.finditer(snippet)) # -> only matches renderTags', never matchTagsConfirmed 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):
matchTags(Shared.hs:734) —where matchTags tags = flip elem tags . T.toLowerrejectBadYear(Shared.hs:283) —where rejectBadYear day = case toGregorian day ofgo(Shared.hs:261, insidetabFilter) —where go s =(technically spans onto the next line for the body, but thewhere go s =opener is the same single-line-whereshape;go's other 6 occurrences elsewhere in the same file, which usewhere go :: ...on its own line, are all found correctly)
Proposed Fix
Extend the existing (?:let[ \t]+)? optional skip to also accept where, e.g. (?:(?:let|where)[ \t]+)?, mirroring #1564's fix exactly.
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
- haskell func_start: single-line
let name args = exprlocal bindings are structurally invisible #1564 (closed) — identical fix shape, forlet - 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: typeclass instance methods and where-clause locals without an explicit '::' signature are structurally invisible #1442, haskell func_start: hardcoded '< 2 lines' floor in _slice_by_indentation drops every abstract typeclass method signature #1435 (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): let func_start/args match guard-only defining equations (…