Releases: fthomas/refined
Releases · fthomas/refined
0.9.6
0.9.5
Bug fixes
- Add type parameter for the predicate type to
auto.autoUnwrap
in
order to improve type inference.
(#608, #612 by @fthomas)
Updates
- Update Cats to 1.6.0. (#609 by @scala-steward)
- Update scodec to 1.11.3. (#611 and #617 by @scala-steward)
- Update PureConfig to 0.10.2. (#615 by @scala-steward)
- Update Scala.js to 0.6.27. (#625 by @scala-steward)
- Update Scala 2.13 to 2.13.0-RC1. (#627 by @fthomas)
Released on 2019-04-16
0.9.4
New features
Bug fixes
- Move derivation instances for
RefType
into newcats.derivation
andscalaz.derivation
modules to fix "diverging implicit expansion"
errors with wildcard imports ofcats._
andscalaz._
.
(#554 by @fthomas)
Updates
- Update Scalaz to 7.2.27. (#588 by @scala-steward)
- Update Scala.js to 0.6.26. (#591 by @scala-steward)
- Update PureConfig to 0.10.1. (#593 by @scala-steward)
- Update Cats to 1.5.0. (#594 by @scala-steward)
- Update scopt to 3.7.1. (#597 by @scala-steward)
Released on 2019-01-18
0.9.3
New features
- Add
refinedSize
as extension method tocats.data.NonEmptyList
that returns the size of theNonEmptyList
as aPosInt
.
(#539 by @cb372) - Add refined types for
Byte
,Short
,BigInt
, andBigDecimal
,
likePosByte
,NonNegByte
,NegByte
, etc.
(#567 by @Michaelt293) - Add new
refined-scalacheck_1.13
module which depends on ScalaCheck
1.13 instead of ScalaCheck 1.14 which is used byrefined-scalacheck
.
(#573 by @liff)
Changes
- Drop support for Scala 2.10. (#537 by @fthomas)
- Move
HexStringSpec
into the module forString
predicates.
(#568 by @Michaelt293)
Updates
- Update Scala.js to 0.6.24. (#538 by @fthomas)
- Update Scala Native to 0.3.8. (#546 by @fthomas)
- Update Cats, PureConfig, Scalaz, sbt, and various plugins.
(#552, #555, #562 and #586
by @sh0hei, @liff) - Update Scala 2.13 to 2.13.0-M5. (#571 by @fthomas)
Documentation
- Document missing
String
predicates in the README.
(#565 by @Michaelt293)
Released on 2018-11-01
0.9.2
0.9.1
New features
- Add new
Trimmed
predicate and use it to implementTrimmedString
.
This also addsTrimmedString.trim
to create aTrimmedString
from
an arbitraryString
and anArbitrary
instance forTrimmedString
.
(#504 by @ceedubs) - Add
Arbitrary
instances forNonEmpty
List
s andVector
s.
(#486 by @fthomas) - New predicates
ValidByte
,ValidShort
, andValidFloat
that check
if aString
is a parsableByte
,Short
, orFloat
.
(#492 by @sh0hei)
Changes
- Add tests for refined types.
(#493 by @rider-yi) - Improve performance of
RefinedType#unsafeFrom
.
(#499 by @fthomas) - A
String
containing line terminators is a validTrimmedString
.
(#504 by @ceedubs)
Deprecations
Updates
- Update
refined-scalaz
to Scalaz 7.2.22.
(#500 by @fthomas) - Update
refined-scalacheck
to ScalaCheck 1.14.0.
(#501 by @xuwei-k) - Update Scala.js to 0.6.23.
(#520 by @fthomas) - Update Scala 2.13 to 2.13.0-M4.
(#512 by @fthomas)
Released on 2018-06-27
0.9.0
New features
- Type class derivation for refined types via
Contravariant
or
MonadError
instances of the respective type class. This allows,
for example, to derive encoders and decoders for refined types
via encoders and decoders of their base types.
(#447 by @fommil for Scalaz and
#449 by @fthomas for Cats) - Add
Arbitrary
instances forList
,Vector
, andString
refined
with anySize[P]
. (#455, #471
by @matthedude and @fthomas) - Add
Arbitrary
instance forNonEmptyString
. (#415) - Add
predicates
package which allows to import all predicates
with a singleimport eu.timepit.refined.predicates.all._
.
(#433) - Cross build the
refined
,refined-scalaz
, andrefined-shapeless
modules for Scala Native. (#301, #478) - Add inference rules for
Greater[N] ==> GreaterEqual[N]
and
Less[N] ==> LessEqual[N]
. (#452 by @zainab-ali) - Add new
refined-shapeless
module that providesTypeable
instances
for refined types. (#456 by @umbreak) - Add new
refined-scopt
module for integration of refined types
with scopt.
(#457 by @nrinaudo) - Add
HexString
,MD5
,SHA1
,SHA224
,SHA256
,SHA384
,
andSHA512
types. (#453 by @NeQuissimus) - Add
FiniteString[N]
type forString
s with length less than or
equal toN
. (#437, #479)
Changes
- Change layout of the
types
package to create fewer instances and to
support "auto import" in IntelliJ. (#416, #431) - Move
Validate
instances into the companions of their respective
predicate instead of a prefix because in a future Scala version
prefixes might not be searched for implicits, see
scala-dev/#446. (#438) - Update documentation to solve "exception during macro expansion" errors.
(#451 by @umbreak) - Change the definition of
MaxSize[N]
fromSize[LessEqual[N]]
to
Size[Interval.Closed[_0, N]]
and introduce theWitnessAs
type class
which unifies numeric type class instances that were split to work with
literal singleton types andshapeless.Nat
.
(#473, #483)
Deprecations and removals
- Deprecate
Subtype
andSupertype
predicates because they lack
practical relevance. (#432) - Deprecate
ConstructorNames
andFieldNames
predicates because they
operate on types instead of values (i.e. the result of a validation
only depends on the type of a value) and the library focuses on
refining values. (#435) - Remove deprecated
util.time
module which has been replaced by
thetypes.time
module. (#425) - Remove deprecated
Refined#get
method which has been replaced by
Refined#value
. (#426) - Deprecate
scalacheck.util.Adjacent
in favor ofinternal.Adjacent
in the core module. (#475) - Deprecate
scalacheck.util.Bounded
in favor ofapi.{Min, Max}
in the core module. (#482)
Updates and build
- Update
refined-cats
to Cats 1.1.0. (#467) - Update
refined-scalaz
to Scalaz 7.2.21. (#434, #468
by @fthomas and @fommil) - Update to the latest
travis_setup.sh
for Scala Native.
(#458 by @densh)
Released on 2018-04-22
0.8.7
New features
- Add
MinValue
andMaxValue
to companions of numeric refined types
via the newMin
andMax
type classes:Thanks to Howy Perrin! (#383)scala> PosInt.MinValue res0: eu.timepit.refined.types.all.PosInt = 1 scala> PosInt.MaxValue res1: eu.timepit.refined.types.all.PosInt = 2147483647
- Support
Divisible[N]
ifN
is a literal integral type. (#413) - Add floating-point refined types like
PosDouble
,NegDouble
, and more
to theeu.timepit.refined.types.numeric
module.
Thanks to Yuki Ishikawa! (#414) - Add
IPv6
predicate forString
s.
Thanks to Tim Steinbach! (#357)
Bug fixes
- Fix
Modulo
predicate for largeLong
values by avoidingtoDouble
in itsValidate
instance. This also restricts the predicate to types
with anIntegral
instance.
Thanks to Howy Perrin! (#398)
Updates
- Update to shapeless 2.3.3. (#399)
- Update
refined-cats
to Cats 1.0.1. (#399) - Update
refined-pureconfig
to PureConfig 0.9.0.
Thanks to Olli Helenius! (#410) - Update to Scala.js 0.6.22. (#417)
Released on 2018-01-28
0.8.6
New features
- Add the
validate
method to companions of refined types to accumulate
errors withcats.data.ValidatedNel
. To use this method,syntax._
from therefined-cats
module needs to be imported like this:Thanks to Howy Perrin!scala> import eu.timepit.refined.types.numeric.PosInt scala> import eu.timepit.refined.cats.syntax._ scala> PosInt.validate(1) res0: cats.data.ValidatedNel[String,PosInt] = Valid(1)
(#382, #384) - Add the
validate
method usingscalaz.ValidationNel
also to the
refined-scalaz
module.
Thanks to kusamakura! (#385)
New predicates
ValidInt
: checks if aString
is a parsableInt
ValidLong
: checks if aString
is a parsableLong
ValidDouble
: checks if aString
is a parsableDouble
ValidBigInt
: checks if aString
is a parsableBigInt
ValidBigDecimal
: checks if aString
is a parsableBigDecimal
Thanks to kusamakura! (#379)
Performance improvements
- Apply the optimization done in #334 also to macro calls that
useRefineMacro.implApplyRef
. Before this change, compilation time
of e.g.PosInt(1)
was one order of magnitude slower than1: PosInt
.
With this change there is no difference in compilation times between
these two calls. (#388)
Updates
- Update
refined-cats
to Cats 1.0.0. (#390)
Released on 2017-12-27
0.8.5
New features
- Add
RefinedTypeOps
to simplify the definition of a refined type's
companion object and theRefinedType
type class which combines
RefType
andValidate
instances for a refined type. With the
former a companion of a refined type can now defined like this:This change also adds companion objects for the refined types in// definition of the refined type `PosInt` scala> type PosInt = Int Refined Positive // definition of the companion object for `PosInt` scala> object PosInt extends RefinedTypeOps[PosInt, Int] scala> PosInt(1) // create `PosInt`s from literals res0: PosInt = 1 scala> PosInt.from(2) // create `PosInt`s from runtime values res1: Either[String, PosInt] = Right(2)
theeu.timepit.refined.types
package which simplifies creating
values of these types a lot.
(#342, #369, #193) - Support
BigInt
andBigDecimal
literals in compile-time checks.
For example, this is now possible:Thanks to kusamakura!scala> val x: BigDecimal Refined Positive = BigDecimal("2E+500") x: BigDecimal Refined Positive = 2E+500 scala> val x: BigDecimal Refined Positive = BigDecimal("-2E+500") <console>:50: error: Predicate failed: (-2E+500 > 0). val x: BigDecimal Refined Positive = BigDecimal("-2E+500") ^
(#345) - Add
IPv4
predicate forString
s and refined types for private IPv4
addresses. Thanks to Tim Steinbach!
(#356) - Add
cats.Order
instance for any refined type whose base type has
also anOrder
instance.
Thanks to Howy Perrin! (#376) - Add
Validate[ByteVector, Size[P]]
instance to therefined-scodec
module. This allows to refineByteVector
s with theSize
predicate,
for example:(#365)scala> refineV[Size[Equal[W.`2L`.T]]](ByteVector.fromValidHex("0xabcd")) res0: Either[String, ByteVector Refined Size[Equal[Long(2L)]]] = Right(ByteVector(2 bytes, 0xabcd))
- Add a
TrimmedString
refined type forString
s without leading or
trailing whitespace. (#275)
Changes
- Split objects in
refined-scalacheck
into traits and objects for
easier reuse. Thanks to Nicolas Rinaudo!
(#343)
Updates
- Update
refined-cats
to Cats 1.0.0-RC2. (#375, #350) - Update to Scala.js 0.6.21. (#351)
- Update
refined-scalaz
to Scalaz 7.2.17. (#360)
Released on 2017-12-19