Why is there no splitBy in the list module?

There is already lines. Why not generalise it to take an additional parameter '\n' and call it split or splitBy? There are some cases where you want to split a list not on '\n'. Marc

Marc Weber
There is already lines. Why not generalise it to take an additional parameter '\n' and call it split or splitBy? There are some cases where you want to split a list not on '\n'.
Indeed, and in e.g. ByteString and MissingH, there are more functions of this kind. I find that I've needed split/break type functions of various kinds, and the standard functions don't seem to be too consistently named. I think it would be nice to have an orthogonal product of predicate types: () a a->Bool [a]->Bool (of increasing generality) and result types: ([a],[a]) and [[a]] (split one - split all). -k -- If I haven't seen further, it is by standing in the footprints of giants
participants (2)
-
Ketil Malde
-
Marc Weber