Skip to content

Instantly share code, notes, and snippets.

@hamnis
Last active May 14, 2018 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamnis/a14e7d16c82df292833121b3f6088328 to your computer and use it in GitHub Desktop.
Save hamnis/a14e7d16c82df292833121b3f6088328 to your computer and use it in GitHub Desktop.
type ValueDirective[F[+_], A] = Directive[F, Response[F], A]
type ResponseDirective[F[+_]] = ValueDirective[F, Response[F]]
def directiveFor[F[+_]](resish: F[Response[F]])(implicit d: Directives[F]): ResponseDirective[F] = {
import d._
import ops._
for {
_ <- Method.GET
res <- successF(resish)
} yield { res }
}
def directiveflatMap[F[+_]](res: F[Response[F]])(implicit d: Directives[F]): ResponseDirective[F] = {
import d._
import ops._
Method.GET.flatMap(_ => successF(res))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment