Last active
May 14, 2018 18:33
-
-
Save hamnis/a14e7d16c82df292833121b3f6088328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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