Skip to content
Browse files

remove instance for CoflatMap

In order to test it it requires Cogen which needs Comonad which I
can't figure out how to implement. Return arbitrary instances to use
`AsyncStream.of` allowing the testing of only one item at a time. This
is due to the fact that `fromSeq` causes testing hangs locally.
  • Loading branch information...
chris-vale-ck authored and travisbrown committed Mar 19, 2018
1 parent 8af6913 commit d7ef0fb47de91c81e56aad2e5a936b86b0119f41
@@ -1,14 +1,14 @@
package io.catbird
package util

import cats.{ CoflatMap, Eq, Monoid, StackSafeMonad, Semigroup }
import cats.{ Eq, Monad, Monoid, StackSafeMonad, Semigroup }
import com.twitter.concurrent._
import com.twitter.util._

trait AsyncStreamInstances extends AsyncStreamInstances1 {

implicit final val asyncStreamInstances: StackSafeMonad[AsyncStream] with CoflatMap[AsyncStream] =
new AsyncStreamCoflatMap with StackSafeMonad[AsyncStream] {
implicit final val asyncStreamInstances: Monad[AsyncStream] =
new StackSafeMonad[AsyncStream] {
final def pure[A](a: A): AsyncStream[A] = AsyncStream.of(a)
final def flatMap[A, B](fa: AsyncStream[A])(f: A => AsyncStream[B]): AsyncStream[B] = fa.flatMap(f)
override final def map[A, B](fa: AsyncStream[A])(f: A => B): AsyncStream[B] =
@@ -34,11 +34,6 @@ trait AsyncStreamInstances1 {

private[util] abstract class AsyncStreamCoflatMap extends CoflatMap[AsyncStream] {
final def coflatMap[A, B](fa: AsyncStream[A])(f: AsyncStream[A] => B): AsyncStream[B] = AsyncStream(f(fa))


private[util] class AsyncStreamSemigroup[A](implicit A: Semigroup[A]) extends Semigroup[AsyncStream[A]] {
final def combine(fa: AsyncStream[A], fb: AsyncStream[A]): AsyncStream[A] = fa.flatMap { a => b => A.combine(a,b) )
@@ -16,7 +16,7 @@ trait ArbitraryInstances {

implicit def asyncStreamArbitrary[A](implicit A: Arbitrary[A]): Arbitrary[AsyncStream[A]] =

implicit def rerunnableArbitrary[A](implicit A: Arbitrary[A]): Arbitrary[Rerunnable[A]] =

0 comments on commit d7ef0fb

Please sign in to comment.
You can’t perform that action at this time.