Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ inThisBuild(
url("https://pepegar.com")
)
)
))
)
)

val Versions = Map(
"circe" -> "0.13.0",
Expand Down Expand Up @@ -59,7 +60,8 @@ val filterConsoleScalacOptions = { options: Seq[String] =>
"-Ywarn-unused-import",
"-Ywarn-dead-code",
"-Xfatal-warnings"
))
)
)
}

val buildSettings = Seq(
Expand Down Expand Up @@ -115,7 +117,6 @@ val commonDependencies = Seq(
"org.typelevel" %% "cats-core" % Versions("cats"),
"org.typelevel" %% "cats-free" % Versions("cats"),
"org.typelevel" %% "alleycats-core" % Versions("cats"),
"org.typelevel" %% "cats-effect" % Versions("cats-effect"),
"org.typelevel" %% "simulacrum" % Versions("simulacrum"),
"com.github.julien-truffaut" %% "monocle-core" % Versions("monocle"),
"com.github.julien-truffaut" %% "monocle-macro" % Versions("monocle"),
Expand Down Expand Up @@ -174,7 +175,9 @@ lazy val circe = project
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % Versions("circe"),
"io.circe" %% "circe-generic" % Versions("circe"),
"io.circe" %% "circe-parser" % Versions("circe")))
"io.circe" %% "circe-parser" % Versions("circe")
)
)
.dependsOn(core)

lazy val apache = project
Expand All @@ -185,6 +188,7 @@ lazy val apache = project
.settings(compilerPlugins)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % Versions("cats-effect"),
"org.apache.httpcomponents" % "httpclient" % Versions("apacheHttp"),
"org.scalatestplus" %% "scalatestplus-mockito" % Versions("scalatestplusMockito") % Test,
"org.mockito" % "mockito-all" % Versions("mockito") % Test
Expand All @@ -200,6 +204,7 @@ lazy val akka = project
.settings(compilerPlugins)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % Versions("cats-effect"),
"com.typesafe.akka" %% "akka-http" % Versions("akka-http"),
"com.typesafe.akka" %% "akka-stream" % Versions("akka-stream"),
"org.mockito" % "mockito-all" % Versions("mockito") % Test,
Expand All @@ -216,6 +221,7 @@ lazy val asynchttpclient = project
.settings(compilerPlugins)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % Versions("cats-effect"),
"org.asynchttpclient" % "async-http-client" % Versions("ahc"),
"org.scalatestplus" %% "scalatestplus-mockito" % Versions("scalatestplusMockito") % Test,
"org.mockito" % "mockito-all" % Versions("mockito") % Test
Expand All @@ -231,6 +237,7 @@ lazy val resttemplate = project
.settings(compilerPlugins)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % Versions("cats-effect"),
"com.google.code.findbugs" % "jsr305" % Versions("findbugs") % Optional,
"org.springframework" % "spring-web" % Versions("spring"),
"org.scalatestplus" %% "scalatestplus-mockito" % Versions("scalatestplusMockito") % Test,
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/scala/hammock/marshalling.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package hammock

import cats._
import cats.free._
import cats.effect.Sync

object marshalling {

Expand Down Expand Up @@ -30,10 +29,10 @@ object marshalling {

implicit def marshallC[F[_]](implicit I: InjectK[MarshallF, F]): MarshallC[F] = new MarshallC[F]

implicit def marshallNT[F[_]: Sync]: MarshallF ~> F = λ[MarshallF ~> F] {
implicit def marshallNT[F[_]: MonadThrow]: MarshallF ~> F = λ[MarshallF ~> F] {
case um @ MarshallF.Unmarshall(entity) =>
um.dec
.decode(entity)
.fold(Sync[F].raiseError, Sync[F].pure)
.fold(MonadThrow[F].raiseError, MonadThrow[F].pure)
Comment thread
bplommer marked this conversation as resolved.
Outdated
}
}
7 changes: 3 additions & 4 deletions core/src/main/scala/hammock/package.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import cats._
import cats.data.{EitherK, NonEmptyList}
import cats.free.Free
import cats.effect.Sync

package object hammock {

Expand All @@ -11,12 +10,12 @@ package object hammock {
type HammockF[A] = EitherK[HttpF, MarshallF, A]

implicit class HttpRequestIOSyntax[A](fa: Free[HttpF, A]) {
def exec[F[_]: Sync](implicit interp: InterpTrans[F]): F[A] =
def exec[F[_]: MonadThrow](implicit interp: InterpTrans[F]): F[A] =
fa foldMap interp.trans
}

implicit class HammockFSyntax[A](fa: Free[HammockF, A]) {
def exec[F[_]: Sync](implicit NT: HammockF ~> F): F[A] =
def exec[F[_]: MonadThrow](implicit NT: HammockF ~> F): F[A] =
fa foldMap NT
}

Expand All @@ -29,7 +28,7 @@ package object hammock {
}
}

implicit def hammockNT[F[_]: Sync](
implicit def hammockNT[F[_]: MonadThrow](
implicit H: InterpTrans[F],
M: MarshallF ~> F
): HammockF ~> F = H.trans or M
Expand Down