This is almost a fold, but seemingly not quite? I know I've seem some talk of folds that potentially "quit" early. but not sure where I saw that, or if it fits.
f xs [] = False
f xs (y:ys) | any c ys' = True
| otherwise = f (nub (y:xs)) (ys' ++ ys)
where ys' = g y xs