-
-
Save armanbilge/55ca32eb8f3e377d14cc9cb716cce3d4 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
//> using scala "2.13.10" | |
//> using lib "org.typelevel::cats-effect::3.3.14" | |
//> using plugin "org.typelevel:::kind-projector:0.13.2" | |
import cats._ | |
import cats.data._ | |
import cats.effect._ | |
package org { | |
package object http4s { | |
// type Routes[F[_], A, B] = routesImpl.T[F, A, B] | |
// object Routes { | |
// def apply[F[_], A, B]( | |
// run: A => Resource[F, Option[B]] | |
// ): Routes[F, A, B] = | |
// routesImpl[F, A, B](Kleisli[Resource[F, *], A, Option[B]](run)) | |
// } | |
sealed abstract class RoutesImpl { | |
type T[F[_], A, B] | |
def apply[F[_], A, B]( | |
fa: Kleisli[Resource[F, *], A, Option[B]] | |
): T[F, A, B] | |
def value[F[_], A, B]( | |
t: T[F, A, B] | |
): Kleisli[Resource[F, *], A, Option[B]] | |
} | |
val routesImpl = new RoutesImpl { | |
type T[F[_], A, B] = Kleisli[Resource[F, *], A, Option[B]] | |
def apply[F[_], A, B]( | |
fa: Kleisli[Resource[F, *], A, Option[B]] | |
): T[F, A, B] = fa | |
def value[F[_], A, B]( | |
t: T[F, A, B] | |
): Kleisli[Resource[F, *], A, Option[B]] = t | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment