sealed trait UserGetter[A]
object UserGetter {
final case class Get(userName: UserName) extends UserGetter[Either[Error, Option[User]]]
}
sealed trait UserPasswordChecker[A]
object UserPasswordChecker {
final case class Check(clientSecret: UserPassword, hashText: BcryptHashText)
extends UserPasswordChecker[Either[Error, Boolean]]
}
Program:
type PRG = UserGetter :|: UserPasswordChecker :|: NilDSL
type O = Either[Error, ?] :&: Option :&: Bulb
for {
u <- UserGetter.Get(UserName(username)).freeko[PRG, O]
r <- UserPasswordChecker.Check(UserPassword(password), u.hashedPassword).freeko[PRG, O]
if (r)
} yield {
Option(u)
}
Compile Error:
value filter is not a member of freek.OnionT[cats.free.Free,[A]freek.In2[oauth2.domain.adt.UserGetter,oauth2.domain.adt.UserPasswordChecker,A],O,Boolean]
OnionT should implement [MonadFilter](https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/MonadFilter.scala) !?
I think it is very common to use guards in for comprehensions.
If FreeK offers this feature, it should be more nicer~
ADT:
Program:
Compile Error:
OnionT
should implement[MonadFilter](https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/MonadFilter.scala)
!?I think it is very common to use guards in for comprehensions.
If
FreeK
offers this feature, it should be more nicer~