Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix Scalastyle
  • Loading branch information
travisbrown committed Dec 30, 2015
1 parent 052b4ba commit f9f7e1b
Show file tree
Hide file tree
Showing 29 changed files with 18 additions and 21 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Expand Up @@ -46,9 +46,9 @@ lazy val baseSettings = Seq(
case Some((2, 10)) => false case Some((2, 10)) => false
case _ => true case _ => true
} }
) ),
(scalastyleSources in Compile) <++= sourceDirectories in Compile
) )

lazy val allSettings = buildSettings ++ baseSettings ++ publishSettings lazy val allSettings = buildSettings ++ baseSettings ++ publishSettings


lazy val commonJsSettings = Seq( lazy val commonJsSettings = Seq(
Expand All @@ -71,7 +71,7 @@ lazy val root = project.in(file("."))
.aggregate(core, coreJS, task) .aggregate(core, coreJS, task)
.dependsOn(core) .dependsOn(core)


lazy val coreBase = crossProject.in(file("core")) lazy val coreBase = crossProject.crossType(CrossType.Pure).in(file("core"))
.settings( .settings(
moduleName := "iteratee-core", moduleName := "iteratee-core",
name := "core", name := "core",
Expand Down
Expand Up @@ -18,6 +18,9 @@ abstract class Enumerator[F[_], E] extends Serializable { self =>


final def map[B](f: E => B)(implicit F: Monad[F]): Enumerator[F, B] = mapE(Enumeratee.map(f)) final def map[B](f: E => B)(implicit F: Monad[F]): Enumerator[F, B] = mapE(Enumeratee.map(f))


final def flatMap[B](f: E => Enumerator[F, B])(implicit F: Monad[F]): Enumerator[F, B] =
mapE(Enumeratee.flatMap(f))

final def prepend(e: E)(implicit F: Monad[F]): Enumerator[F, E] = { final def prepend(e: E)(implicit F: Monad[F]): Enumerator[F, E] = {
new Enumerator[F, E] { new Enumerator[F, E] {
def apply[A](s: Step[F, E, A]): F[Step[F, E, A]] = F.flatMap( def apply[A](s: Step[F, E, A]): F[Step[F, E, A]] = F.flatMap(
Expand All @@ -36,9 +39,6 @@ abstract class Enumerator[F[_], E] extends Serializable { self =>
final def apply[A](s: Step[F, E, A]): F[Step[F, E, A]] = F.flatMap(self(s))(e2(_)) final def apply[A](s: Step[F, E, A]): F[Step[F, E, A]] = F.flatMap(self(s))(e2(_))
} }


final def flatMap[B](f: E => Enumerator[F, B])(implicit F: Monad[F]) =
mapE(Enumeratee.flatMap(f))

final def flatten[B](implicit M: Monad[F], ev: E =:= F[B]): Enumerator[F, B] = final def flatten[B](implicit M: Monad[F], ev: E =:= F[B]): Enumerator[F, B] =
flatMap(e => Enumerator.liftM(ev(e))) flatMap(e => Enumerator.liftM(ev(e)))


Expand Down
Expand Up @@ -202,7 +202,7 @@ final object Iteratee extends IterateeInstances {
* *
* @group Utilities * @group Utilities
*/ */
final def fail[F[_], T, E, A](e: T)(implicit F: MonadError[F, T]): Iteratee[F, E, A] = Iteratee.liftM(F.raiseError[A](e)) final def fail[F[_], T, E, A](e: T)(implicit F: MonadError[F, T]): Iteratee[F, E, A] = liftM(F.raiseError[A](e))


/** /**
* An iteratee that reads nothing from a stream. * An iteratee that reads nothing from a stream.
Expand Down
Expand Up @@ -5,22 +5,19 @@ import cats.functor.Contravariant
import io.iteratee.internal.{ Input, Step } import io.iteratee.internal.{ Input, Step }


private[iteratee] trait IterateeInstances extends IterateeInstances0 { private[iteratee] trait IterateeInstances extends IterateeInstances0 {
implicit final def iterateeContravariant[F[_]: Monad, A]: Contravariant[ implicit final def iterateeContravariant[F[_]: Monad, A]: Contravariant[({ type L[x] = Iteratee[F, x, A] })#L] =
({ type L[x] = Iteratee[F, x, A] })#L new Contravariant[({ type L[x] = Iteratee[F, x, A] })#L] {
] = new Contravariant[({ type L[x] = Iteratee[F, x, A] })#L] { def contramap[E, E2](r: Iteratee[F, E, A])(f: E2 => E) = r.contramap(f)
def contramap[E, E2](r: Iteratee[F, E, A])(f: E2 => E) = r.contramap(f) }
}


implicit final def iterateeMonadError[F[_], T, E](implicit F: MonadError[F, T]): MonadError[ implicit final def iterateeMonadError[F[_], T, E]
({ type L[x] = Iteratee[F, E, x] })#L, (implicit F: MonadError[F, T]): MonadError[({ type L[x] = Iteratee[F, E, x] })#L, T] =
T new IterateeMonadError[F, T, E](F)
] = new IterateeMonadError[F, T, E](F)
} }


private[iteratee] trait IterateeInstances0 { private[iteratee] trait IterateeInstances0 {
implicit final def iterateeMonad[F[_], E](implicit F: Monad[F]): Monad[ implicit final def iterateeMonad[F[_], E](implicit F: Monad[F]): Monad[({ type L[x] = Iteratee[F, E, x] })#L] =
({ type L[x] = Iteratee[F, E, x] })#L new IterateeMonad[F, E](F)
] = new IterateeMonad[F, E](F)
} }


private class IterateeMonad[F[_], E](F: Monad[F]) extends Monad[({ type L[x] = Iteratee[F, E, x] })#L] { private class IterateeMonad[F[_], E](F: Monad[F]) extends Monad[({ type L[x] = Iteratee[F, E, x] })#L] {
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -15,7 +15,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.4") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.5") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.5")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.7.0") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.2.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.2.0")
addSbtPlugin("org.brianmckenna" % "sbt-wartremover" % "0.13") addSbtPlugin("org.brianmckenna" % "sbt-wartremover" % "0.13")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.2") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.2")
2 changes: 1 addition & 1 deletion scalastyle-config.xml
Expand Up @@ -14,7 +14,7 @@
</check> </check>
<check level="error" class="org.scalastyle.file.FileLineLengthChecker" enabled="true"> <check level="error" class="org.scalastyle.file.FileLineLengthChecker" enabled="true">
<parameters> <parameters>
<parameter name="maxLineLength"><![CDATA[100]]></parameter> <parameter name="maxLineLength"><![CDATA[120]]></parameter>
</parameters> </parameters>
</check> </check>
<check level="error" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true"></check> <check level="error" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true"></check>
Expand Down

0 comments on commit f9f7e1b

Please sign in to comment.