Repository navigation
Description
Summary
Haskell's let name args = expr local bindings declared inline in do blocks are not captured by the current func_start regex, causing systematic under-detection of a common Haskell idiom.
Root Cause
The func_start regex in gitgalaxy/standards/language_standards.py for Haskell has a local-binding alternative (second |-separated branch) that matches indented name args = expr lines, but excludes lines via a negative lookahead for keywords including let: (?!(?:case|class|data|default|deriving|do|else|foreign|if|import|in|infix|infixl|infixr|instance|let|mdo|module|newtype|of|then|type|where)\b).
This lookahead is anchored right after the indentation, so it's meant to stop let itself from being mistaken for a function name — but it has the unintended side effect of blocking the entire line whenever it starts with let , meaning a real local binding declared inline as let name args = expr is never matched at all. The regex never retries past the let token to find the real name that follows.
Verification
Tested the regex directly in a REPL against this snippet, which returns zero matches:
convertWithOpts scriptingEngine opts = do
let outputFile = fromMaybe "-" (optOutputFile opts)
let defFlavor fmt = Format.FlavoredFormat fmt mempty
let isWarning msg = messageVerbosity msg == WARNINGConfirmed real-world instances missed in the pinned language-crucible/data/haskell/pandoc corpus (all genuine let name args = expr one-liners):
defFlavor(App.hs:152)makeSandboxed(App.hs:165)isWarning(App.hs:114)isPandocCiteproc(Filter.hs — pattern-matched two-clause form at similar shape)filterWithPath(Filter.hs:52) —let filterWithPath constr = maybe missingPath (return . constr . T.unpack)
Scope Note
This is distinct from #1435 (typeclass method signature floor) and #1442 (typeclass instance methods / where-clause locals without ::). This issue is specifically the let-inside-do-block one-liner shape.
Important: Fixing 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: detector.py's start_line looks shifted by roughly one prior function when short definitions are stacked #1532 (open)
- 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
fix(haskell): correct line-shift, let-binding blindness, and prime-na…
fix(haskell): let func_start/args match same-line where-clause bindin…
fix(haskell): let func_start/args match guard-only defining equations (…