Releases: kevin-lee/refined4s
v0.15.0
0.15.0 - 2024-04-13
New Features
-
[
refined4s-core
] AddNonBlankString
which can be neither all whitespace chars nor an empty String (#281)NonBlankString("") // Invalid value: [""]. It must be not all whitespace non-empty String NonBlankString(" ") // Invalid value: [" "]. It must be not all whitespace non-empty String NonBlankString(" ") // Invalid value: [" "]. It must be not all whitespace non-empty String NonBlankString("\n") // Invalid value: ["\n"]. It must be not all whitespace non-empty String NonBlankString("\t") // Invalid value: ["\t"]. It must be not all whitespace non-empty String NonBlankString("\t\n") // Invalid value: ["\t\n"]. It must be not all whitespace non-empty String NonBlankString(" \t \n") // Invalid value: [" \t \n"]. It must be not all whitespace non-empty String
-
[
refined4s-cats
] Addcats
support forNonBlankString
(#283) -
[
refined4s-circe
] Addcirce
support forNonBlankString
(#284) -
[
refined4s-pureconfig
] Addpureconfig
support forNonBlankString
(#285) -
[
refined4s-doobie
] Adddoobie
support forNonBlankString
(#286) -
[
refined4s-extras-render
] Addextras-render
support forNonBlankString
(#287) -
[
refined4s-tapir
] Addtapir
support forNonBlankString
(#288)
v0.14.0
0.14.0 - 2024-04-05
New Features
- Add
refined4s-tapir
to supporttapir
(#272) - [
refined4s-tapir
] AddTapirNewtypeSchema
andTapirRefinedSchema
to supportsttp.tapir.Schema
forrefined4s
(#273) - [
refined4s-tapir
] AddSchema
s for pre-defined refined types (#276) - [
refined4s-tapir
] AddSchema
type-class instances with auto deriving (#278)
v0.13.0
0.13.0 - 2024-01-21
New Features
- [
refined4s-core
] AddUrl
torefined4s.types.network
and the type-class instances forUrl
in the other modules (#246)
- [
refined4s-core
] AddUuid
String
which can be validated asjava.util.UUID
and the type-class instances forUuid
in the other modules (#248)
- [
refined4s-core
] AddUri.apply(java.net.URI)
(#251)
- [
refined4s-core
] AddUrl.apply(java.net.URL)
(#252)
- [
refined4s-refined-compat-scala2
] AddUri
,Url
andUuid
(#255)
v0.12.0
0.12.0 - 2024-01-20
New Feature
-
[
refined4s-core
] Make pre-defined types intypes.all
importable from each type category (i.e.numeric
,strings
andnetwork
) (#237)So it means a type like
refined4s.types.numeric.NegInt
should be exactly the same asrefined4s.types.all.NegInt
.
- Add
refined4s-refined-compat
modules for compatibility with therefined
library in Scala 2 (#241)refined4s-refined-compat-scala2
for compatibility withrefined
in Scala 2refined4s-refined-compat-scala3
for just usingrefined4s
in Scala 3
- Add
RefinedCompatAllTypes
torefined4s-refined-compat-scala2
andrefined4s-refined-compat-scala3
(#243)
Internal Change
-
[
refined4s-core
] MoveMinValue
andMaxValue
from eachMinMax
toMin
andMax
(#239)e.g.)
type NegInt = NegInt.Type object NegInt extends Numeric[Int], MinMax[Int] { override def min: Type = apply(Int.MinValue) override def max: Type = apply(-1) val MinValue: Type = min val MaxValue: Type = max }
to
trait Min[A] { self: NewtypeBase[A] => def min: Type val MinValue: Type = min } trait Max[A] { self: NewtypeBase[A] => def max: Type val MaxValue: Type = max }
v0.11.0
0.11.0 - 2024-01-04
New Feature
-
[
refined4s-core
] AddMinValue
andMaxValue
to refined basic numeric types (#223)- Add
Min
trait - Add
Max
trait - Add
MinMax
trait
Add
MinMax
to the following types to haveMinValue
andMaxValue
NegInt
NonNegInt
PosInt
NonPosInt
NegLong
NonNegLong
PosLong
NonPosLong
NegShort
NonNegShort
PosShort
NonPosShort
NegByte
NonNegByte
PosByte
NonPosByte
NegFloat
NonNegFloat
PosFloat
NonPosFloat
NegDouble
NonNegDouble
PosDouble
NonPosDouble
- Add
Internal Change
- [
refined4s-core
] MoveNumeric
andInlinedNumeric
fromnumeric
trait tonumeric
object (#225)
v0.10.0
0.10.0 - 2024-01-02
New Feature
- Release
refined4s-extras-render
module (#220) - Add
refined4s-extras-render
to supportRender
forrefined4s
(#215)e.g.)refined4s.modules.extras.derivation.ExtrasRender refined4s.modules.extras.derivation.types.all.given refined4s.modules.extras.derivation.generic.auto.given
import extras.render.Render import refined4s.types.all.* import refined4s.modules.extras.derivation.types.all.given val name = NonEmptyString("Kevin") Render[NonEmptyString].render(name) // String = Kevin
import extras.render.Render import refined4s.Newtype import refined4s.modules.extras.derivation.ExtrasRender type Name = Name.Type object Name extends Newtype[String], ExtrasRender[String] val name = Name("Kevin") Render[Name].render(name) // String = Kevin
import extras.render.Render import refined4s.Newtype type Name = Name.Type object Name extends Newtype[String] import refined4s.modules.extras.derivation.generic.auto.given val name = Name("Kevin") Render[Name].render(name) // String = Kevin
v0.9.0
0.9.0 - 2024-01-02
NOTE:
refined4s-extras-render
was not released by mistake, and it will be released inv0.10.0
.
New Feature
- Add
refined4s-extras-render
to supportRender
forrefined4s
(#215)e.g.)refined4s.modules.extras.derivation.ExtrasRender refined4s.modules.extras.derivation.types.all.given refined4s.modules.extras.derivation.generic.auto.given
import extras.render.Render import refined4s.types.all.* import refined4s.modules.extras.derivation.types.all.given val name = NonEmptyString("Kevin") Render[NonEmptyString].render(name) // String = Kevin
import extras.render.Render import refined4s.Newtype import refined4s.modules.extras.derivation.ExtrasRender type Name = Name.Type object Name extends Newtype[String], ExtrasRender[String] val name = Name("Kevin") Render[Name].render(name) // String = Kevin
import extras.render.Render import refined4s.Newtype type Name = Name.Type object Name extends Newtype[String] import refined4s.modules.extras.derivation.generic.auto.given val name = Name("Kevin") Render[Name].render(name) // String = Kevin
v0.8.0
v0.7.0
0.7.0 - 2023-12-30
Changes
- [
refined4s-cats
] RenamevalidateAs
inrefined4s.modules.cats.syntax
torefinedNewtypeNec
(#182)
-
[
refined4s-core
] MovetoValue
fromrefined4s.syntax
torefined4s.NewtypeBase
(#186)So with the given following code,
import refined4s.* import refined4s.types.all.* type Name = Name.Type object Name extends Newtype[NonEmptyString]
the following is possible without importing any
syntax
.val name = Name(NonEmptyString("Kevin")) name.toValue // String = "Kevin"
New Features
-
[
refined4s-cats
] AddrefinedNewtypeNel
inrefined4s.modules.cats.syntax
(#184)import refined4s.* import refined4s.types.all.* import refined4s.modules.cats.syntax.* type Name = Name.Type object Name extends Newtype[NonEmptyString] "Kevin".refinedNewtypeNel[Name] // EitherNel[String, Name] = Right(Name(NonEmptyString("Kevin"))) "".refinedNewtypeNel[Name] // EitherNel[String, Name] = Left(NonEmptyList("Failed to create Name: Invalid value: []. It has to be a non-empty String but got \"\"))
-
[
refined4s-cats
] AddvalidateAs
inrefined4s.modules.cats.syntax
to validate a value and returnValidated
(#188)import refined4s.* import refined4s.types.all.* import refined4s.modules.cats.syntax.* type Name = Name.Type object Name extends Newtype[NonEmptyString] "Kevin".validateAs[Name] // Validated[String, Name] = Valid(Name(NonEmptyString("Kevin"))) "".validateAs[Name] // Validated[String, Name] = Invalid("Failed to create Name: Invalid value: []. It has to be a non-empty String but got \"\")
-
[
refined4s-cats
] AddvalidateNecAs
inrefined4s.modules.cats.syntax
to validate a value and returnValidatedNec
(#189)import refined4s.* import refined4s.types.all.* import refined4s.modules.cats.syntax.* type Name = Name.Type object Name extends Newtype[NonEmptyString] "Kevin".validateNecAs[Name] // ValidatedNec[String, Name] = Valid(Name(NonEmptyString("Kevin"))) "".validateNecAs[Name] // ValidatedNec[String, Name] = Invalid(NonEmptyChain("Failed to create Name: Invalid value: []. It has to be a non-empty String but got \"\"))
-
[
refined4s-cats
] AddvalidateNelAs
inrefined4s.modules.cats.syntax
to validate a value and returnValidatedNel
(#190)import refined4s.* import refined4s.types.all.* import refined4s.modules.cats.syntax.* type Name = Name.Type object Name extends Newtype[NonEmptyString] "Kevin".validateNelAs[Name] // ValidatedNel[String, Name] = Valid(Name(NonEmptyString("Kevin"))) "".validateNelAs[Name] // ValidatedNel[String, Name] = Invalid(NonEmptyList("Failed to create Name: Invalid value: []. It has to be a non-empty String but got \"\"))
-
[
refined4s-cats
] AddderivedOrder
to have the instance ofOrder[A]
derived fromCoercible[A, B]
andOrder[B]
(#194)Given
import refined4s.* type MyNum = MyNum.Type object MyNum extends Newtype[Int]
it can be
import cats.* val n1 = MyNum(1) val n2 = MyNum(2) Order[MyNum].compare(n1, n2) // Int = -1
-
[
refined4s-core
] AddCanBeOrdered
for providingOrdering
andConversion[Type, Ordered[Type]]
(#196)import refined4s.* type MyNum = MyNum.Type object MyNum extends Newtype[Int]
val input1 = MyNum(1) val input2 = MyNum(2) Ordering[MyNum].compare(input1, input2) // Int = -1 (input1: Ordered[MyNum]).compare(input2) // Int = -1
- [
refined4s-core
] MakeNonEmptyString
CanBeOrdered
to haveOrdering[NonEmptyString]
andConversion[NonEmptyString, Ordered[NonEmptyString]]
(#198)
- [
refined4s-cats
] AddCatsOrder
(#203)import refined4s.* type MyNum = MyNum.Type object MyNum extends Newtype[Int], CatsOrder[Int]
import cats.* val myNum1 = NyNum(1) val myNum2 = NyNum(2) Order[MyNum].compare(myNum1, myNum1) // Int = 0 Order[MyNum].compare(myNum1, myNum2) // Int = -1 Order[MyNum].compare(myNum2, myNum1) // Int = 1
Internal Changes
- [
refined4s-core
] ReplaceOrdering
andConversion[Type, Ordered[Type]]
for numeric types withCanBeOrdered
(#199)
v0.6.0
0.6.0 - 2023-12-28
Changes
- All modules: importing
derivation.instances.given
can cause an issue as it overrides all type-classes defined in the companion objects (#163)-
[
refined4s-cats
] Add explicitEq
andShow
for pre-defined types (#171)- Now it has
refined4s.modules.cats.derivation.types.all
for the all pre-defined types (e.g.NegInt
,PosInt
,NonEmptyString
, etc.) refined4s.modules.cats.derivation.instances
=>refined4s.modules.cats.derivation.generic.auto
refined4s.modules.cats.derivation.instances.contraCoercible
is moved torefined4s.modules.cats.syntax
- Now it has
-
[
refined4s-circe
] Add explicitEncoder
andDecoder
for pre-defined types (#166) -
[
refined4s-pureconfig
] Add explicitConfigReader
andConfigWriter
for pre-defined types (#172) -
[
refined4s-doobie
] Add explicitGet
andPut
for pre-defined types (#173)
-
-
[
refined4s-core
] Keep onlyall
object
for pre-defined types and remove all the others (#168)So this will be the only
import
available for using pre-defined typesimport refined4s.types.all.*
The following ones have been removed.
import refined4s.types.numeric.* import refined4s.types.strings.* import refined4s.types.network.*
- Rename derived type classes - some of them have a naming conflict issue (#165)