[Repo Assist] Add missing NonEmptyList functions and tests for Seq/NonEmptyList#229
Conversation
Task 5 (Coding Improvements): Add commonly-used but missing functions to NonEmptyList module (addresses issue #174): - iter, iteri: iterate elements (with/without index) - mapi: indexed map returning NonEmptyList - exists, forall: predicate checks - contains: element membership test - sort, sortBy, sortWith: sorting (preserves NonEmptyList invariant) - maxBy, minBy: min/max by projection Task 9 (Testing Improvements): Add tests for previously untested functions: - NonEmptyList: cons, appendList, toSeq, and all new functions above - Seq: cons, unCons, findExactlyOne, catOptions, choice1s, choice2s, partitionChoices, equalsWith, groupNeighboursBy All 706 tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/repo-assist format the code and check the code formatting check passes |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
|
/repo-assist fix this CI build error
|
The NonEmptyList<'T> type has a private backing record field { List: 'T list }.
Inline functions expand at the call site which cannot access private fields,
causing FS1113. Removing inline from contains and sort fixes the build.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
This PR addresses two improvement tasks:
Task 5 — Coding Improvements: Add missing
NonEmptyListfunctions (related to #174)Issue #174 notes that many standard
Listmodule functions are absent fromNonEmptyList. This adds the most commonly-used ones that preserve correctness:iter/iterimapiNonEmptyListexists/forallcontainssort/sortBy/sortWithmaxBy/minByFunctions that could return an empty collection (e.g.
filter,choose) were intentionally excluded as they would returnlistrather thanNonEmptyList, and adding them would require a separate design decision.Task 9 — Testing Improvements: Tests for previously untested functions
NonEmptyListtests added:cons,appendList,toSeq, and all new functions above.Seqmodule tests added (functions had no test coverage):Seq.cons,Seq.unConsSeq.findExactlyOneSeq.catOptionsSeq.choice1s,Seq.choice2s,Seq.partitionChoicesSeq.equalsWithSeq.groupNeighboursByTest Status
✅ All 706 tests pass (6 pre-existing ignored tests unchanged). Build produces only pre-existing warnings.