Permalink
Browse files

Fixed takeWhile in ListT and StreamT

  • Loading branch information...
ekmett authored and jsuereth committed Apr 21, 2011
1 parent 83986cc commit 85cf5faf17958132dd4da9978ea7c1022ecf4def
Showing with 2 additions and 2 deletions.
  1. +1 −1 core/src/main/scala/scalaz/ListT.scala
  2. +1 −1 core/src/main/scala/scalaz/StreamT.scala
@@ -32,7 +32,7 @@ sealed class ListT[M[_],A](val step : M[ListT.Step[A, ListT[M,A]]]) {
)
def takeWhile(p: A => Boolean)(implicit M: Functor[M]): ListT[M,A] = ListT[M,A](
step map {
- case Yield(a,as) => if (!p(a)) Skip(as takeWhile p) else Yield(a,as)
+ case Yield(a,as) => if (!p(a)) Done else Yield(a,as takeWhile p)
case Skip(as) => Skip(as takeWhile p)
case Done => Done
}
@@ -43,7 +43,7 @@ sealed class StreamT[M[_],A](stepper: => M[StreamT.Step[A, StreamT[M,A]]]) {
)
def takeWhile(p: A => Boolean)(implicit M: Functor[M]): StreamT[M,A] = StreamT[M,A](
step map {
- case Yield(a,as) => if (!p(a)) Skip(as takeWhile p) else Yield(a,as)
+ case Yield(a,as) => if (!p(a)) Done else Yield(a,as takeWhile p)
case Skip(as) => Skip(as takeWhile p)
case Done => Done
}

0 comments on commit 85cf5fa

Please sign in to comment.