λ1001: Use of Enumerable.Repeat for a single element
Enumerable.Repeat(value, 1) should be replaced with Sequence.Return(value).
Cause
Enumerable.Repeat is called with a constant count of 1.
Reason for rule
Repeating a value exactly once is a roundabout way of saying "a sequence containing this one element".
Funcky provides Sequence.Return for precisely this purpose. It states the intent directly and mirrors
the Return operation of the other monads in the library.
How to fix violations
Replace the call with Sequence.Return(value). A code fix is available.
Examples
Disallowed
IEnumerable<string> greeting = Enumerable.Repeat("hello", 1);
Allowed
IEnumerable<string> greeting = Sequence.Return("hello");
// Repeating a value more than once is fine.
IEnumerable<string> echo = Enumerable.Repeat("hello", 3);