sinwe on Use_github_action
sinwe on master
Removed circleci #75 Updated scala 2.12.12, 2.13.4 a… Notify via telegram and 3 more (compare)
sinwe on Use_github_action
Remove .travis.yml (compare)
sinwe on Use_github_action
Always notify via telegram (compare)
Cats has chosen to require this method of all monad implementations as opposed to just a subset
so if you're willing to give up Bracket, then a subset of these other operations should still be doable
Partly yes, this is when I encounter problem that when I use resources that needs to be closed depending on the outcome, it’s not easy to write the code. And I found this bracket code and found it easy to use it. So I apply it here.
package reactor.util.scala.context
import reactor.util.context.Context
object SContext {
implicit class ContextOps(context: Context) {
def getOrNone[T](key: AnyRef): Option[T] = {
val x = context.getOrEmpty[T](key)
if(x.isPresent) Option(x.get())
else None
}
}
}
getOrEmpty
type param is just for convenience and can't actually perform a type check(throwing a ClassCastException if it's not of type T),TypeTag
and return None
in the case that there is a value for the key, but of the wrong type.
Stream
instead of LazyList
. Some will cause breaking changes (especially when returning Stream
, it is now returning LazyList
). But those with parameterStream
, I made it deprecated and provide another operator using LazyList
.