Closed josephcsible closed 4 years ago
I think people who use inductive naturals know what they are doing. So they can safely ignore this particular inspection if they find it unhelpful. We could patch the existing pattern for STAN-0104 to not warn on this inspection if it's used with the inductive nats type, but there's no data Nat = Z | S Nat
type in base
or any of the boot libraries, so such pattern won't be helpful. Also, partially because of that, we can't really suggest using this data type as a possible solution: not clear what is the default library choice for such type, we can't write a pattern to not warn on this inspection when this solution is applied, and the code can become less performant due to usage of inductive naturals.
STAN-0104 should mention that
genericLength
is safe to use even on infinite lists as long as it's used at a type likedata Nat = Zero | Succ Nat
. (This doesn't apply to 0105 or 0106, sincesum (repeat Zero)
andproduct (repeat (Succ Zero))
would still both be bottom.