I don’t know how to add a comment onto Steve’s answer, but I would like to recommend the
GHC libraries documentation,
and in there specifically the
Sublist functions in Data.List
Which is much better as a reference, than just reading the plain Haskell report.
Generically, a fold with a rule on when to create a new sublist to feed, should solve it too.