Skip to content

Instantly share code, notes, and snippets.

@stew
Created July 8, 2014 04:26
Show Gist options
  • Save stew/6de78f99bc218f050a1a to your computer and use it in GitHub Desktop.
Save stew/6de78f99bc218f050a1a to your computer and use it in GitHub Desktop.
class Auths[F[_]](implicit I: Inject[Auth,F]) {
def login(id: UserId, pwd: Password): FreeC[F,Option[User]] =
lift(Login(id, pwd))
def hasPermission(u: User, p: Permission): FreeC[F,Boolean] =
lift(HasPermission(u, p))
type AuthCoyo[A] = Coyoneda[F, A]
type AuthFree[A] = Free[AuthCoyo, A]
def point[A](a: ⇒ A): Free.FreeC[F, A] = Monad[AuthFree].point(a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment