Just add the following to your libraryDependencies in SBT:

libraryDependencies += "com.pepegar" %% "hammock" % "0.6.3" // for JVM
libraryDependencies += "com.pepegar" %%% "hammock" % "0.6.3" // for JS


There are already some companion modules implemented to ease the experience of using hammock.

libraryDependencies += "com.pepegar" %% "hammock-circe" % "0.6.3" // for JVM
libraryDependencies += "com.pepegar" %%% "hammock-circe" % "0.6.3" // for JS

Functional programming

Hammock tries to be as functional as possible. For example, the environment in wich all the actions will be executed is called Monad, but fear not! Lots of types you were using before are already monads, you know how to use them!


With Hammock you can do HTTP operations in a typeful and functional way.

import cats._
import cats.implicits._
import scala.util.{ Failure, Success, Try }
import io.circe._
import hammock._
import hammock.Uri._
import hammock.hi._
import hammock.circe.implicits._

object HttpClient {
  implicit val interp = Interpreter()

  val response = Hammock
    .getWithOpts(Uri.unsafeParse(""), Opts.default)
scala> HttpClient.response
res2: scala.util.Try[List[String]] = Success(List(0cdc651e, 42286d75, 4f97a2e9, 54bf6aa9, 61b4b03d, 61fc54d5, 94c3cd60, dd69cf53, fc6de645))

Target Monad

You can use as a target monad any type F that has an instance of MonadError[F, Throwable]. There are already several types you can use out of the box, for example:

  • Future: There are lots of applications out there that express their IO effects with Future, you can still use it!
  • Try: You don’t care of blocking current thread? go ahead, use it!
  • monix/Task: Great implementation of a concurrency monad. You can learn more about it here