Skip to content

Commit

Permalink
Remove a runtime Cons allocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
milanshen committed Feb 3, 2016
1 parent 68d6062 commit e180959
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/data/Streaming.scala
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ sealed abstract class Streaming[A] extends Product with Serializable { lhs =>
this match {
case Empty() => Empty()
case Wait(lt) => Wait(lt.map(_.dropWhile(f)))
case Cons(a, lt) => if (f(a)) Wait(lt.map(_.dropWhile(f))) else Cons(a, lt)
case s @ Cons(a, lt) => if (f(a)) Wait(lt.map(_.dropWhile(f))) else s
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/data/StreamingT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ sealed abstract class StreamingT[F[_], A] extends Product with Serializable { lh
*/
def dropWhile(f: A => Boolean)(implicit ev: Functor[F]): StreamingT[F, A] =
this match {
case Cons(a, ft) => if (f(a)) Wait(ft.map(_.dropWhile(f))) else Cons(a, ft)
case s @ Cons(a, ft) => if (f(a)) Wait(ft.map(_.dropWhile(f))) else s
case Wait(ft) => Wait(ft.map(_.dropWhile(f)))
case Empty() => Empty()
}
Expand Down

0 comments on commit e180959

Please sign in to comment.