Skip to content

Commit

Permalink
Merge pull request #1 from ceedubs/streaming-doctest
Browse files Browse the repository at this point in the history
Use sbt-doctest for some Streaming(T) examples
  • Loading branch information
mikejcurry committed Feb 3, 2016
2 parents 6cec86b + 4e70028 commit 68d6062
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
18 changes: 10 additions & 8 deletions core/src/main/scala/cats/data/Streaming.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
20 changes: 12 additions & 8 deletions core/src/main/scala/cats/data/StreamingT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 68d6062

Please sign in to comment.