Stream.headOption implemented using foldRight