The function you need is similar to unfoldr. If you bring consumein the following form:
consume' :: [a] -> Maybe (b,[a])
consume' Nothing Just ... . , :
wrap :: ([a] -> (b,[a])) -> [a] -> Maybe (b,[a])
wrap f [] = Nothing
wrap f xs = Just $ f xs
consume unfoldr consume :: [a] -> (b,[a]) :
unfoldr (wrap consume)