Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refined4s v0.1.0
0.1.0 - 2023-12-10
New Features
Add
Refined[A]
(#1)A trait
Refined[A]
should provide a way to create a refined type with validation.It should also provide a way to validate in compile-time if applicable.
So it should be able to do like this.
[core] Add
NonEmptyString
(#5)[core] Add
numeric.NegInt
(#7)[core] Add
numeric.NonPosInt
(#8)[core] Add
numeric.PosInt
(#9)[core] Add
numeric.NonNegInt
(#10)[core] Add
numeric.Numeric
(#11)Numeric[A: math.Ordering]
providesOrdering[Numeric[A]#Type]
derived fromA
andOrdered[Numeric[A]#Type]
converted fromOrdering[Numeric[A]#Type]
.[core] Add
numeric.NegLong
(#18)[core] Add
numeric.NonNegLong
(#19)[core] Add
numeric.PosLong
(#20)[core] Add
numeric.NonPosLong
(#21)Extract the essential properties of
Refined
and createRefinedBase
(#30)Refined
toRefinedBase
Refined
Refined
should have only theapply
method for the compile-time validation to create a value for the refined type.Add
InlinedRefined
(#32)It should look like this.
Add
deriving
to derive type-class from the base type (#40)Add
Coercible
to type-safely cast refined type to the actual type (#42)NOTE: For this ticket, the focus is solely on adding
Coercible
; subsequent integration withRefined
to utilizeCoercible
will be addressed later.The idea of
Coercible
is from scala-newtype'sCoercible
.Add
Newtype
(#44)It is solely to create a
newtype
just like anopaque type
but with a few mandatory methods and type-classes.Then it can be
Make
RefinedBase
extendNewtypeBase
to support unwrapping (getting value) forRefined
andInlinedRefined
types withCoercible
(#46)Add
RefinedCtor[T, A]
to provide a way to create a validated typeT
from an actual typeA
with validation (#49)NOTE: This ticket is only about adding
RefinedCtor[T, A]
, so providingRefinedCtor
forRefined
andInlinedRefined
will be done separately.Add
RefinedCtor
type-class instance forRefinedBase
(#51)Add
A.refinedTo[T]
syntax to createRefined[A]
andInlinedRefined[A]
(#53)Add
T.coerce[A]
syntax to easily get the valueA
fromRefined[A]#Type
andInlinedRefined[A]#Type
(#55)Add
refinedNewtype
syntax to createNewtype
containingRefined[A]
orInlinedRefined[A]
(#57)Add
refined4s-cats
module and addvalidateAs
syntax to createNewtype
containingRefined[A]
orInlinedRefined[A]
(#59)Add
toValue
syntax to get the value fromNewtype
containingRefined[A]
orInlinedRefined[A]
(#61)[
refined4s-cats
] AddCatsEq
,CatsShow
andCatsEqShow
to deriveEq
andShow
from the actual type'sEq
andShow
(#63)Use
deriving
fornumericOrdering: Ordering[Type]
inNumeric[A]
(#65)can be
so
Number
s don't have to be like thisbut it can be
[core] Add
NegShort
,NonNegShort
,PosShort
andNonPosShort
tonumeric
package (#67)[core] Add
NegByte
,NonNegByte
,PosByte
andNonPosByte
tonumeric
package (#70)[core] Add
NegFloat
,NonNegFloat
,PosFloat
andNonPosFloat
tonumeric
package (#72)[core] Add
NegDouble
,NonNegDouble
,PosDouble
andNonPosDouble
tonumeric
package (#76)[core] Add
NegBigInt
,NonNegBigInt
,PosBigInt
andNonPosBigInt
tonumeric
package (#79)[core] Add
NegBigDecimal
,NonNegBigDecimal
,PosBigDecimal
andNonPosBigDecimal
tonumeric
package (#83)NOTE: Also
InlinedNumeric
was added to support compile-time validation for the refinedBigInt
and refinedBigDecimal
.InlinedNumeric[A: math.Ordering]
providesOrdering[InlinedNumeric[A]#Type]
derived fromA
andOrdered[InlinedNumeric[A]#Type]
converted fromOrdering[InlinedNumeric[A]#Type]
.[core] Add
Uri
tonetwork
package (#85)[core] Add
types
package and movenumeric
,strings
andnetwork
to it (#87)[core] Add
all
package torefined4s.types
and make it contain all packages in thetypes
package (#89)So the following
is equivalent to