Skip to content

Commit

Permalink
Override size in Chain instance (#2425)
Browse files Browse the repository at this point in the history
* Override size in Chain instance

This should be a slight optimization.

* Update Chain.scala
  • Loading branch information
ceedubs authored and kailuowang committed Aug 20, 2018
1 parent c3b3ad6 commit fe409cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/src/main/scala/cats/data/Chain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ private[data] sealed abstract class ChainInstances extends ChainInstances1 {
override def exists[A](fa: Chain[A])(p: A => Boolean): Boolean = fa.exists(p)
override def forall[A](fa: Chain[A])(p: A => Boolean): Boolean = fa.forall(p)
override def find[A](fa: Chain[A])(f: A => Boolean): Option[A] = fa.find(f)
override def size[A](fa: Chain[A]): Long = fa.length

def coflatMap[A, B](fa: Chain[A])(f: Chain[A] => B): Chain[B] = {
@tailrec def go(as: Chain[A], res: ListBuffer[B]): Chain[B] =
Expand Down

0 comments on commit fe409cf

Please sign in to comment.