A monadic iterator