streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Some suggested naming changes

Open harendra-kumar opened this issue 3 months ago • 0 comments

Because of termination in folds and scans there are two variants - one-shot and repeated.

  • fold: one-shot fold
  • foldMany => groups: repeated folds, consistent with groupsWhile
  • foldManySepBy => groupsSepBy
  • foldMaybes: maybe stream folded to a Maybe; one-shot
  • groupMaybes: maybe stream folded to Maybes in groups
  • foldEithers: either stream folded to an Either; one-shot
  • groupEithers: either stream foled to Eithers in groups
  • scanlMany => rescanl: restart the scan after it terminates

Changing foldMany to groups makes it shorter and it is still intuitive and consistent with some other names. Alternatively, we can leave it as is and name groupMaybes, groupEtihers to foldManyMaybes, foldManyEithers etc. Or just use inconsistent naming, groups at some place and foldMany at others.

We can leave parseMany as is or rename to parseGroups?

Similar changes can be made to Folds and Parsers.

-- group* can also be named as refold* but group is more intuitive -- Refold can be named as Infold (suggesting extra input or nesting fusion - like Unfold) instead to avoid confusion.

harendra-kumar avatar Sep 19 '25 11:09 harendra-kumar