Releases: ustitc/krefty
Releases · ustitc/krefty
0.5.0
Add instance creation helper ⭐
Introducing Refinery
🏭 a helper class for creating instances of types:
@JvmInline
value class Name private constructor(private val value: String) {
companion object : Refinery<String, Name>() {
override fun Refinement<String>.refine() = filter { it.isNotBlank() }.map { Name(it) }
}
}
val grog = Name.fromOrThrow("Grog") // returns a Name instance "Grog"
val void = Name.fromOrThrow("") // throws RefinementException
Add Arrow support ⭐
A new module krefty-arrow
was created to support working with Either
type
Deprecate Predicate ⏳
Removing Predicate
support in favour of (T) -> Boolean
Remove Refined 🛑
Refined
was completely replaced by Refinement
0.4.1
Turn refinements into lazy monads ⭐
Refined
turning into a Refinement
monad 👾
Now the base type value can be retrieved by calling getOrThrow
, getOrError
, getOrElse
, getOrNull
. It also can be transformed as Collections/Either/Ior with map
and flatMap
functions
Deprecate Refined ⌛
The refined
function is deprecated:
"Krefty" refined NotBlank() // eagerly convert to Refined or throw exception
Now refine
and get*
functions must be called instead:
val refined = "Krefty" refine NotBlank()
refined.getOrThrow()