Skip to content

Releases: fthomas/refined

0.8.5

19 Dec 19:08
v0.8.5
bf1813a
Compare
Choose a tag to compare

New features

  • Add RefinedTypeOps to simplify the definition of a refined type's
    companion object and the RefinedType type class which combines
    RefType and Validate instances for a refined type. With the
    former a companion of a refined type can now defined like this:
    // 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)
    This change also adds companion objects for the refined types in
    the eu.timepit.refined.types package which simplifies creating
    values of these types a lot.
    (#342, #369, #193)
  • Support BigInt and BigDecimal literals in compile-time checks.
    For example, this is now possible:
    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")
                                                          ^
    Thanks to kusamakura!
    (#345)
  • Add IPv4 predicate for Strings 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 an Order instance.
    Thanks to Howy Perrin! (#376)
  • Add Validate[ByteVector, Size[P]] instance to the refined-scodec
    module. This allows to refine ByteVectors with the Size predicate,
    for example:
    scala> refineV[Size[Equal[W.`2L`.T]]](ByteVector.fromValidHex("0xabcd"))
    res0: Either[String, ByteVector Refined Size[Equal[Long(2L)]]] = Right(ByteVector(2 bytes, 0xabcd))
    (#365)
  • Add a TrimmedString refined type for Strings 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

04 Oct 19:06
v0.8.4
bdb0ab8
Compare
Choose a tag to compare

Performance improvements

  • Avoid calling eval in refine and infer macros for known RefType
    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 few Validate instances.
    In combination with the above change, this can reduce compilation times
    up to 67%. (#334)
  • Inline Validate.instance in the definition of Validate.fromPredicate.
    This makes refineV[Positive](x) for instance 25% faster. (#335)
  • Optimize Validate instances that are built with Validate.fromPartial.
    (#336)

Released on 2017-10-04

0.8.3

04 Oct 19:05
v0.8.3
902a3eb
Compare
Choose a tag to compare

New features

  • Add new port number types toeu.timepit.refined.types.net like
    SystemPortNumber and NonSystemPortNumber.
    Thanks to Shohei Shimomura!
    (#294 #304)
  • Add the refined-jsonpath subproject which provides the JSONPath
    predicate that checks if a String is a valid JSONPath.
    Thanks to Iurii Susuk! (#305)

Bug fixes

  • Tighten Validate instance for UUID by allowing only Strings 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

04 Oct 19:04
v0.8.2
9105ef7
Compare
Choose a tag to compare

Changes

  • Add the refined-cats subproject which adds Eq and Show
    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

04 Oct 19:03
v0.8.1
b4fee2c
Compare
Choose a tag to compare

New predicates

numeric

  • Modulo[N, O]: checks if a numeric value modulo N is O. (#278)
  • Divisible[N]: checks if a numeric value is evenly divisible by N. (#278)
  • NonDivisible[N]: checks if a numeric value is not evenly divisible by N. (#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

17 Mar 04:44
v0.8.0
4056752
Compare
Choose a tag to compare

Changes

  • Improve MacroUtils.eval by calling duplicate 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

17 Mar 04:43
v0.7.0
5b6a3bf
Compare
Choose a tag to compare

Changes

  • Move the Eval predicate into the new refined-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

Released on 2017-01-24

0.6.2

12 Jan 04:26
v0.6.2
e6ca411
Compare
Choose a tag to compare

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 from util.time to the types.time package.
    (#236, #240, #249)
  • Add Cogen instance for any refined type to refined-scalacheck.
    (#244, #248)

Updates

Released on 2017-01-12

0.6.1

24 Dec 05:30
8b35922
Compare
Choose a tag to compare

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 of Refined#value to avoid
    confusion with Option#get which is an unsafe operation while
    Refined#get was always safe. (#220)
  • Remove deprecated RefinePartiallyApplied.force which has been
    renamed to unsafeFrom 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

24 Dec 05:26
0a3922c
Compare
Choose a tag to compare

Changes

  • Replace the type parameter P in RefType#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