Releases: fthomas/refined
Releases · fthomas/refined
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
0.8.4
Performance improvements
- Avoid calling
eval
in refine and infer macros for knownRefType
instances. This reduces compilation times by roughly 26% for all
compile-time refinements with common predicates.
(#332, #333) - Avoid calling
eval
in refine macros for a fewValidate
instances.
In combination with the above change, this can reduce compilation times
up to 67%. (#334) - Inline
Validate.instance
in the definition ofValidate.fromPredicate
.
This makesrefineV[Positive](x)
for instance 25% faster. (#335) - Optimize
Validate
instances that are built withValidate.fromPartial
.
(#336)
Released on 2017-10-04
0.8.3
New features
- Add new port number types to
eu.timepit.refined.types.net
like
SystemPortNumber
andNonSystemPortNumber
.
Thanks to Shohei Shimomura!
(#294 #304) - Add the
refined-jsonpath
subproject which provides theJSONPath
predicate that checks if aString
is a valid JSONPath.
Thanks to Iurii Susuk! (#305)
Bug fixes
- Tighten
Validate
instance forUUID
by allowing onlyString
s of
length 36 in the standard 8-4-4-4-12 representation.
Thanks to Yuki Ishikawa!
(#296, #300)
Updates
- Update to Scala.js 0.6.20. (#290, #303, #303,
#324) - Update
refined-cats
to Cats 1.0.0-MF.
Thanks to Shohei Shimomura! (#311) - Update
refined-scalaz
to Scalaz 7.2.15. (#312) - Update
refined-pureconfig
to PureConfig 0.8.0. (#323)
Also many thanks to ronanM,
Leif Wickland, and
Richard Gomes for various improvements.
Released on 2017-09-06
0.8.2
Changes
- Add the
refined-cats
subproject which addsEq
andShow
instances for any refined type.
Thanks to Derek Morr!
(#284)
Updates
- Update
refined-pureconfig
to PureConfig 0.7.2.
Thanks to Viktor Lövgren!
(#283) - Update
refined-scalaz
to Scalaz 7.2.13. (#288)
Released on 2017-06-02
0.8.1
New predicates
Modulo[N, O]
: checks if a numeric value moduloN
isO
. (#278)Divisible[N]
: checks if a numeric value is evenly divisible byN
. (#278)NonDivisible[N]
: checks if a numeric value is not evenly divisible byN
. (#278)Even
: checks if a numeric value is evenly divisible by 2. (#278)Odd
: checks if a numeric value is not evenly divisible by 2. (#278)
Thanks to Viktor Lövgren for these predicates!
Updates
- Update
refined-pureconfig
to PureConfig 0.7.0.
Thanks to Torsten Scholak!
(#273) - Update to Scala.js 0.6.16. (#270, #279)
- Update
refined-scalaz
to Scalaz 7.2.12. (#281)
Released on 2017-05-08
0.8.0
Changes
- Improve
MacroUtils.eval
by callingduplicate
before untypechecking
the tree. (#262) Hopefully this fixes nondeterministic compiler
crashes like #260. - Remove "provided" from the dependency on the Scala compiler again.
This means that you do not need to add a dependency on the compiler if
you are using refined's macros. (#268) See #256 for more
details.
Updates
- Update
refined-pureconfig
to PureConfig 0.6.0.
Thanks to Viktor Lövgren!
(#264) - Update
refined-scalaz
to Scalaz 7.2.10.
(#258, #267)
Released on 2017-03-17
0.7.0
Changes
-
Move the
Eval
predicate into the newrefined-eval
module
because it requires a runtime dependency on the Scala compiler.
Consequently the dependency on the Scala compiler in the core
module is changed to a "provided" dependency.
Thanks to Chris Hodapp!
(#207, #251)Note that if you are using refined's macros, you need to add
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided
now to your
libraryDependencies
.
Updates
- Update
refined-pureconfig
to PureConfig 0.5.1.
(#252)
Released on 2017-01-24
0.6.2
Changes
- Add aliases for standard refined types like
type PosInt = Int Refined Positive
or
type NegInt = Int Refined Negative
to the
eu.timepit.refined.types
package. The date and time related type
aliases haven been moved fromutil.time
to thetypes.time
package.
(#236, #240, #249) - Add
Cogen
instance for any refined type torefined-scalacheck
.
(#244, #248)
Updates
- Update
refined-pureconfig
to PureConfig 0.5.0.
(#245)
Released on 2017-01-12
0.6.1
Changes
- Add the
refined-pureconfig
subproject which adds support for
refined types to PureConfig.
Thanks to Viktor Lövgren! (#233) - Deprecate
Refined#get
in favor ofRefined#value
to avoid
confusion withOption#get
which is an unsafe operation while
Refined#get
was always safe. (#220) - Remove deprecated
RefinePartiallyApplied.force
which has been
renamed tounsafeFrom
in version 0.5.0. (#225)
Updates
- Update to Scala 2.12.1. (#226)
- Update to Scala.js 0.6.14. (#232)
- Update
refined-scalaz
to Scalaz 7.2.8. (#223)
Released on 2016-12-24
0.6.0
Changes
- Replace the type parameter
P
inRefType#unwrap
with an
existential type. (#192)
Updates
- Update
refined-scalacheck
to ScalaCheck 1.13.3. (#128, #210) - Update
refined-scalaz
to Scalaz 7.2.6. (#198) - Update
refined-scodec
to scodec 1.10.3. (#187, #212) - Update Scala.js to 0.6.13. (#194, #197, #206)
- Update shapeless to 2.3.2. (#196)
Released on 2016-10-20