travisbrown / iteratee
Showing 14 of 42 files from the diff.

@@ -1,10 +1,10 @@
Loading
1 1
package io.iteratee
2 2
3 -
import cats.{ Applicative, Defer, Eval, FlatMap, Monad, MonadError, Monoid, Semigroup }
3 +
import cats.{Applicative, Defer, Eval, FlatMap, Monad, MonadError, Monoid, Semigroup}
4 4
import cats.kernel.Eq
5 5
import io.iteratee.internal.Step
6 6
import scala.Predef._
7 -
import scala.util.{ Left, Right }
7 +
import scala.util.{Left, Right}
8 8
9 9
/**
10 10
 * @tparam F The effect type constructor

@@ -1,7 +1,7 @@
Loading
1 1
package io.iteratee.modules
2 2
3 3
import cats.kernel.Eq
4 -
import io.iteratee.{ Enumeratee, Enumerator, Iteratee }
4 +
import io.iteratee.{Enumeratee, Enumerator, Iteratee}
5 5
6 6
/**
7 7
 * @groupname Enumeratees Enumeratees

@@ -17,7 +17,7 @@
Loading
17 17
  OutputStream,
18 18
  OutputStreamWriter
19 19
}
20 -
import java.util.zip.{ ZipEntry, ZipFile }
20 +
import java.util.zip.{ZipEntry, ZipFile}
21 21
import scala.Predef.genericArrayOps
22 22
import scala.collection.JavaConverters._
23 23
@@ -129,7 +129,7 @@
Loading
129 129
        F.flatten(
130 130
          F.delay(
131 131
            if (iterator.hasNext) {
132 -
              val entry = iterator.next
132 +
              val entry = iterator.next()
133 133
134 134
              F.flatMap(s.feedEl((entry, zipFile.getInputStream(entry))))(apply)
135 135
            } else F.pure(s)

@@ -1,6 +1,6 @@
Loading
1 1
package io.iteratee.modules
2 2
3 -
import cats.{ Applicative, MonadError, Monoid, MonoidK, Semigroup }
3 +
import cats.{Applicative, MonadError, Monoid, MonoidK, Semigroup}
4 4
import cats.data.NonEmptyList
5 5
import io.iteratee.Iteratee
6 6

@@ -1,9 +1,9 @@
Loading
1 1
package io.iteratee.files.modules
2 2
3 3
import cats.effect.Sync
4 -
import _root_.io.iteratee.{ Enumerator, Iteratee }
4 +
import _root_.io.iteratee.{Enumerator, Iteratee}
5 5
import _root_.io.iteratee.modules.Module
6 -
import java.io.{ File, InputStream, OutputStream }
6 +
import java.io.{File, InputStream, OutputStream}
7 7
import java.util.zip.ZipEntry
8 8
9 9
trait FileModule[F[_]] { this: Module[F] { type M[f[_]] = Sync[f] } =>

@@ -1,10 +1,10 @@
Loading
1 1
package io.iteratee.benchmark
2 2
3 -
import cats.Id
3 +
import cats.{Id, catsInstancesForId}
4 4
import cats.effect.IO
5 -
import cats.instances.int._
6 -
import fs2.{ Stream => StreamF }
7 -
import io.{ iteratee => i }
5 +
import cats.effect.unsafe.implicits.global
6 +
import fs2.{Stream => StreamF}
7 +
import io.{iteratee => i}
8 8
import java.util.concurrent.TimeUnit
9 9
import org.openjdk.jmh.annotations._
10 10
import scala.Predef.intWrapper
@@ -40,10 +40,10 @@
Loading
40 40
  def sumInts0II: Int = intsII.into(i.Iteratee.sum)
41 41
42 42
  @Benchmark
43 -
  def sumInts1IO: Int = intsIO.into(i.Iteratee.sum).unsafeRunSync
43 +
  def sumInts1IO: Int = intsIO.into(i.Iteratee.sum).unsafeRunSync()
44 44
45 45
  @Benchmark
46 -
  def sumInts3F: Int = intsF.fold1(_ + _).compile.last.unsafeRunSync.get
46 +
  def sumInts3F: Int = intsF.fold1(_ + _).compile.last.unsafeRunSync().get
47 47
48 48
  @Benchmark
49 49
  def sumInts4C: Int = intsC.sum
@@ -66,10 +66,10 @@
Loading
66 66
  def takeLongs0II: Vector[Long] = longStreamII.into(i.Iteratee.take(count))
67 67
68 68
  @Benchmark
69 -
  def takeLongs1IO: Vector[Long] = longStreamIO.into(i.Iteratee.take(count)).unsafeRunSync
69 +
  def takeLongs1IO: Vector[Long] = longStreamIO.into(i.Iteratee.take(count)).unsafeRunSync()
70 70
71 71
  @Benchmark
72 -
  def takeLongs3F: Vector[Long] = longStreamF.take(count.toLong).compile.toVector.unsafeRunSync
72 +
  def takeLongs3F: Vector[Long] = longStreamF.take(count.toLong).compile.toVector.unsafeRunSync()
73 73
74 74
  @Benchmark
75 75
  def takeLongs4C: Vector[Long] = longStreamC.take(count).toVector

@@ -1,12 +1,12 @@
Loading
1 1
package io.iteratee
2 2
3 -
import cats.{ Eval, Id, Monad, MonadError, catsInstancesForId }
3 +
import cats.{Eval, Id, Monad, MonadError, catsInstancesForId}
4 4
import cats.data.EitherT
5 5
import cats.instances.either.catsStdInstancesForEither
6 6
import cats.instances.future.catsStdInstancesForFuture
7 7
import cats.instances.option.catsStdInstancesForOption
8 8
import cats.instances.try_.catsStdInstancesForTry
9 -
import scala.concurrent.{ ExecutionContext, Future }
9 +
import scala.concurrent.{ExecutionContext, Future}
10 10
import scala.util.Try
11 11
12 12
package object modules {

@@ -1,7 +1,7 @@
Loading
1 1
package io.iteratee.files
2 2
3 -
import cats.effect.{ IO, Sync }
4 -
import io.iteratee.modules.{ EnumerateeModule, EnumeratorErrorModule, IterateeErrorModule, Module }
3 +
import cats.effect.{IO, Sync}
4 +
import io.iteratee.modules.{EnumerateeModule, EnumeratorErrorModule, IterateeErrorModule, Module}
5 5
6 6
package modules {
7 7
  final object io extends IOModule
@@ -14,6 +14,6 @@
Loading
14 14
      with IterateeErrorModule[IO, Throwable] {
15 15
    type M[f[_]] = Sync[f]
16 16
17 -
    protected val F: Sync[IO] = IO.ioEffect
17 +
    protected val F: Sync[IO] = IO.asyncForIO
18 18
  }
19 19
}

@@ -1,7 +1,7 @@
Loading
1 1
package io.iteratee.modules
2 2
3 3
import cats.Monad
4 -
import io.iteratee.{ Enumerator, Iteratee }
4 +
import io.iteratee.{Enumerator, Iteratee}
5 5
6 6
/**
7 7
 * @groupname Syntax Extension methods

@@ -1,7 +1,7 @@
Loading
1 1
package io.iteratee
2 2
3 -
import cats.{ Applicative, Eq, FlatMap, Monad }
4 -
import cats.arrow.{ Category, Profunctor }
3 +
import cats.{Applicative, Eq, FlatMap, Monad}
4 +
import cats.arrow.{Category, Profunctor}
5 5
import cats.instances.list.catsStdInstancesForList
6 6
import io.iteratee.internal.Step
7 7
import scala.collection.mutable.Builder
@@ -9,8 +9,8 @@
Loading
9 9
abstract class Enumeratee[F[_], O, I] extends Serializable { self =>
10 10
  def apply[A](step: Step[F, I, A]): F[Step[F, O, Step[F, I, A]]]
11 11
12 -
  final def wrap(enum: Enumerator[F, O])(implicit F: FlatMap[F]): Enumerator[F, I] = new Enumerator[F, I] {
13 -
    final def apply[A](s: Step[F, I, A]): F[Step[F, I, A]] = F.flatMap(self(s))(enum.intoStep)
12 +
  final def wrap(enumerator: Enumerator[F, O])(implicit F: FlatMap[F]): Enumerator[F, I] = new Enumerator[F, I] {
13 +
    final def apply[A](s: Step[F, I, A]): F[Step[F, I, A]] = F.flatMap(self(s))(enumerator.intoStep)
14 14
  }
15 15
16 16
  final def into[A](iteratee: Iteratee[F, I, A])(implicit F: Monad[F]): Iteratee[F, O, A] = iteratee.through(this)

@@ -1,7 +1,7 @@
Loading
1 1
package io.iteratee
2 2
package internal
3 3
4 -
import cats.{ Applicative, Eval, Monad, Monoid, MonoidK, Semigroup }
4 +
import cats.{Applicative, Eval, Monad, Monoid, MonoidK, Semigroup}
5 5
import cats.arrow.FunctionK
6 6
import cats.data.NonEmptyList
7 7

@@ -2,10 +2,9 @@
Loading
2 2
3 3
import cats.Monad
4 4
import cats.effect.IO
5 +
import cats.effect.unsafe.implicits.global
5 6
import cats.free.Free
6 -
import cats.instances.int._
7 -
import cats.instances.try_._
8 -
import io.iteratee.{ Enumerator, Iteratee }
7 +
import io.iteratee.{Enumerator, Iteratee}
9 8
import java.io.InputStream
10 9
import java.util.concurrent.TimeUnit
11 10
import org.openjdk.jmh.annotations._
@@ -39,7 +38,7 @@
Loading
39 38
    }
40 39
41 40
  @Benchmark
42 -
  def avgWordLengthIO: Double = linesIO.flatMap(words[IO]).into(avgLen).unsafeRunSync
41 +
  def avgWordLengthIO: Double = linesIO.flatMap(words[IO]).into(avgLen).unsafeRunSync()
43 42
44 43
  @Benchmark
45 44
  def avgWordLengthTF: Double = linesTF.flatMap(words[Free[Try, *]]).into(avgLen[Free[Try, *]]).runTailRec.get

@@ -1,12 +1,12 @@
Loading
1 1
package io.iteratee.benchmark
2 2
3 -
import cats.{ Monad, MonadError }
4 -
import cats.effect.{ ExitCase, Sync }
3 +
import cats.{Monad, MonadError}
4 +
import cats.effect.Sync
5 5
import cats.free.Free
6 6
import cats.instances.try_._
7 7
import io.iteratee.files.modules.FileModule
8 -
import io.iteratee.modules.{ EnumerateeModule, EnumeratorErrorModule, IterateeErrorModule, Module }
9 -
import scala.util.{ Failure, Success, Try }
8 +
import io.iteratee.modules.{EnumerateeModule, EnumeratorErrorModule, IterateeErrorModule, Module}
9 +
import scala.util.Try
10 10
11 11
object FreeTryModule
12 12
    extends Module[Free[Try, *]]
@@ -26,21 +26,14 @@
Loading
26 26
    def flatMap[A, B](fa: Free[Try, A])(f: A => Free[Try, B]): Free[Try, B] = FF.flatMap(fa)(f)
27 27
    def tailRecM[A, B](a: A)(f: A => Free[Try, Either[A, B]]): Free[Try, B] = FF.tailRecM(a)(f)
28 28
29 -
    // Don't use this; it's a quick hack for benchmarking only.
30 -
    final def bracketCase[A, B](acquire: Free[Try, A])(use: A => Free[Try, B])(
31 -
      release: (A, ExitCase[Throwable]) => Free[Try, Unit]
32 -
    ): Free[Try, B] = acquire.flatMap { a =>
33 -
      val result = use(a)
29 +
    def suspend[A](hint: Sync.Type)(thunk: => A): Free[Try, A] = Free.defer(Free.pure(thunk))
34 30
35 -
      result.fold[Free[Try, B]](
36 -
        b => release(a, ExitCase.complete).map(_ => b),
37 -
        {
38 -
          case Success(f) => release(a, ExitCase.complete).flatMap(_ => f)
39 -
          case Failure(e) => release(a, ExitCase.error(e)).flatMap(_ => result)
40 -
        }
41 -
      )
42 -
    }
43 -
44 -
    def suspend[A](thunk: => Free[Try, A]): Free[Try, A] = Free.defer(thunk)
31 +
    def monotonic: Free[Try, scala.concurrent.duration.FiniteDuration] = Predef.???
32 +
    def realTime: Free[Try, scala.concurrent.duration.FiniteDuration] = Predef.???
33 +
    def canceled: Free[Try, Unit] = Predef.???
34 +
    def forceR[A, B](fa: Free[Try, A])(fb: Free[Try, B]): Free[Try, B] = Predef.???
35 +
    def onCancel[A](fa: Free[Try, A], fin: Free[Try, Unit]): Free[Try, A] = Predef.???
36 +
    def rootCancelScope: cats.effect.kernel.CancelScope = Predef.???
37 +
    def uncancelable[A](body: cats.effect.kernel.Poll[Free[Try, *]] => Free[Try, A]): Free[Try, A] = Predef.???
45 38
  }
46 39
}

@@ -1,6 +1,6 @@
Loading
1 1
package io.iteratee
2 2
3 -
import cats.{ Applicative, Comonad, Contravariant, Eval, Functor, Monad, MonadError, Monoid, MonoidK, Semigroup }
3 +
import cats.{Applicative, Comonad, Contravariant, Eval, Functor, Monad, MonadError, Monoid, MonoidK, Semigroup}
4 4
import cats.arrow.FunctionK
5 5
import cats.data.NonEmptyList
6 6
import io.iteratee.internal.Step
Files Coverage
benchmark/src/main/scala/io/iteratee/benchmark 43.90%
core/src/main/scala/io/iteratee 98.81%
files/src/main/scala/io/iteratee/files 0.00%
Project Totals (15 files) 90.24%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading