How am I supposed to fix STAN-0103 diagnostic?
- Dominant language
- Haskell
- Stars
- 597
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
I have a call of `length xs` in the middle of a function, which Stan is unhappy with because of [STAN-0103](https://github.com/kowainik/stan/wiki/All-Inspections#STAN-0103): "Usage of the `length` function that hangs on infinite lists".
How am I supposed to act on this? Stan offers two suggestions:
* "Don't use `length` if you expect your function to work with infinite lists" - nope, I bloody well need the length of the list.
* "Use the `slist` library for fast and safe functions on infinite lists" - but it does not seem that `Slist.size (Slist.slist xs)` is any safer than `length xs` in case if `xs` happens to be infinite! Am I supposed to make a non-local refactoring, probably migrate the entire module to `Slist`? This is likely to be unfeasible or prohibitively expensive in the majority of real-world cases.
I personally do not think that STAN-0103 is worth to complain about, but that's fine, we can agree to disagree. I don't mind opinionated diagnostics, I do mind unactionable ones: if a policy mandates to maintain a clean Stan report, it's virtually impossible to do so.
Contributor guide
Research direction
Start by examining the STAN-0103 inspection and the linked guidance about `length` and `Slist`. Determine whether the diagnostic can provide an actionable alternative for finite-list use, and consider the issue resolved only when its guidance or behavior addresses the non-local-refactoring concern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100