diff --git a/core/src/main/scala/cats/data/Streaming.scala b/core/src/main/scala/cats/data/Streaming.scala index 640b6bca2d..3106fbca92 100644 --- a/core/src/main/scala/cats/data/Streaming.scala +++ b/core/src/main/scala/cats/data/Streaming.scala @@ -501,10 +501,11 @@ sealed abstract class Streaming[A] extends Product with Serializable { lhs => * If no elements satisfy `f`, an empty stream will be returned. * * For example: - * - * Streaming(1, 2, 3, 4, 5, 6, 7).takeWhile(n => n != 4) - * - * Will result in: Streaming(1, 2, 3) + * {{{ + * scala> val s = Streaming(1, 2, 3, 4, 5, 6, 7) + * scala> s.takeWhile(n => n != 4).toList + * res0: List[Int] = List(1, 2, 3) + * }}} */ def takeWhile(f: A => Boolean): Streaming[A] = this match { @@ -523,10 +524,11 @@ sealed abstract class Streaming[A] extends Product with Serializable { lhs => * If no elements satisfy `f`, the current stream will be returned. * * For example: - * - * Streaming(1, 2, 3, 4, 5, 6, 7).dropWhile(n => n != 4) - * - * Will result in: Streaming(4, 5, 6, 7) + * {{{ + * scala> val s = Streaming(1, 2, 3, 4, 5, 6, 7) + * scala> s.dropWhile(n => n != 4).toList + * res0: List[Int] = List(4, 5, 6, 7) + * }}} */ def dropWhile(f: A => Boolean): Streaming[A] = this match { diff --git a/core/src/main/scala/cats/data/StreamingT.scala b/core/src/main/scala/cats/data/StreamingT.scala index 1ae7150d8f..8d368e0f38 100644 --- a/core/src/main/scala/cats/data/StreamingT.scala +++ b/core/src/main/scala/cats/data/StreamingT.scala @@ -222,10 +222,12 @@ sealed abstract class StreamingT[F[_], A] extends Product with Serializable { lh * If no elements satisfy `f`, an empty stream will be returned. * * For example: - * - * StreamingT[List, Int](1, 2, 3, 4, 5, 6, 7).takeWhile(n => n != 4) - * - * Will result in: StreamingT[List, Int](1, 2, 3) + * {{{ + * scala> import cats.std.list._ + * scala> val s = StreamingT[List, Int](1, 2, 3, 4, 5, 6, 7) + * scala> s.takeWhile(n => n != 4).toList.flatten + * res0: List[Int] = List(1, 2, 3) + * }}} */ def takeWhile(f: A => Boolean)(implicit ev: Functor[F]): StreamingT[F, A] = this match { @@ -244,10 +246,12 @@ sealed abstract class StreamingT[F[_], A] extends Product with Serializable { lh * If no elements satisfy `f`, the current stream will be returned. * * For example: - * - * StreamingT[List, Int](1, 2, 3, 4, 5, 6, 7).dropWhile(n => n != 4) - * - * Will result in: StreamingT[List, Int](4, 5, 6, 7) + * {{{ + * scala> import cats.std.list._ + * scala> val s = StreamingT[List, Int](1, 2, 3, 4, 5, 6, 7) + * scala> s.dropWhile(n => n != 4).toList.flatten + * res0: List[Int] = List(4, 5, 6, 7) + * }}} */ def dropWhile(f: A => Boolean)(implicit ev: Functor[F]): StreamingT[F, A] = this match {