Skip to content

Instantly share code, notes, and snippets.

@tomatophobia
Created May 28, 2021 14:27
Show Gist options
  • Save tomatophobia/a621b9dc607a32a6037898351e96c685 to your computer and use it in GitHub Desktop.
Save tomatophobia/a621b9dc607a32a6037898351e96c685 to your computer and use it in GitHub Desktop.
def translate[F[_]: Monad](app: Http[F]): Http[F] = for {
resp <- app
tx <- Kleisli.liftF(Translator[F](resp.body))
} yield resp.copy(body = tx)
def hello(theUri: Uri): HttpRoutes = HttpRoutes.of {
case Request(POST, uri, name) if uri == theUri =>
Future.successful(Response(OK, s"Hello, $name!"))
}
val es = translate(hello(Uri("/hola")))
// <console>:37: error: could not find implicit value for evidence parameter of type cats.Monad[OptionFuture]
// val es = translate(hello(Uri("/hola")))
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment