Closed EverybodyKurts closed 7 years ago
How about:
splitWhen : (a -> Bool) -> List a -> Maybe ( List a, List a )
splitWhen predicate list =
findIndex predicate list
|> Maybe.map (\i -> splitAt i list)
Wow, way shorter, lol. Looks good to me. Would love to be able to submit a pull request to this repo (with tests included). You think that'd work?
Sure.
(This repo has no maintainer so I'll go ahead and handle this.)
It would combine the following function signatures:
Here's a first stab at it: