:: (a -> Bool) -> [a] -> ([a], [a]) package:ghc

spanEnd p l == reverse (span p (reverse l)). The first list returns actually comes after the second list (when you look at the input list).