Skip to content

Releases: fthomas/refined

0.9.6

31 May 19:35
v0.9.6
Compare
Choose a tag to compare

Updates

Released on 2019-05-25

0.9.5

31 May 19:34
v0.9.5
6e7379b
Compare
Choose a tag to compare

Bug fixes

  • Add type parameter for the predicate type to auto.autoUnwrap in
    order to improve type inference.
    (#608, #612 by @fthomas)

Updates

Released on 2019-04-16

0.9.4

18 Jan 19:19
v0.9.4
debe3d7
Compare
Choose a tag to compare

New features

  • Add NonNaN predicate that checks if a floating-point is not NaN.
    (#596 by @dcastro)

Bug fixes

  • Move derivation instances for RefType into new cats.derivation
    and scalaz.derivation modules to fix "diverging implicit expansion"
    errors with wildcard imports of cats._ and scalaz._.
    (#554 by @fthomas)

Updates

Released on 2019-01-18

0.9.3

02 Nov 05:35
v0.9.3
db0fae0
Compare
Choose a tag to compare

New features

  • Add refinedSize as extension method to cats.data.NonEmptyList
    that returns the size of the NonEmptyList as a PosInt.
    (#539 by @cb372)
  • Add refined types for Byte, Short, BigInt, and BigDecimal,
    like PosByte, 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 by refined-scalacheck.
    (#573 by @liff)

Changes

Updates

Documentation

Released on 2018-11-01

0.9.2

02 Nov 05:36
v0.9.2
a7fc0e3
Compare
Choose a tag to compare

Updates

  • Update refined-scalaz to Scalaz 7.2.25.
    (#536 by @fthomas)

Released on 2018-07-04

0.9.1

02 Nov 05:40
v0.9.1
170d018
Compare
Choose a tag to compare

New features

  • Add new Trimmed predicate and use it to implement TrimmedString.
    This also adds TrimmedString.trim to create a TrimmedString from
    an arbitrary String and an Arbitrary instance for TrimmedString.
    (#504 by @ceedubs)
  • Add Arbitrary instances for NonEmpty Lists and Vectors.
    (#486 by @fthomas)
  • New predicates ValidByte, ValidShort, and ValidFloat that check
    if a String is a parsable Byte, Short, or Float.
    (#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 valid TrimmedString.
    (#504 by @ceedubs)

Deprecations

  • Deprecate RefType#refineMF in favor of RefinedTypeOps.
    (#514 by @fthomas)

Updates

Released on 2018-06-27

0.9.0

23 Apr 07:08
v0.9.0
20ab0fb
Compare
Choose a tag to compare

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 for List, Vector, and String refined
    with any Size[P]. (#455, #471
    by @matthedude and @fthomas)
  • Add Arbitrary instance for NonEmptyString. (#415)
  • Add predicates package which allows to import all predicates
    with a single import eu.timepit.refined.predicates.all._.
    (#433)
  • Cross build the refined, refined-scalaz, and refined-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 provides Typeable 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,
    and SHA512 types. (#453 by @NeQuissimus)
  • Add FiniteString[N] type for Strings with length less than or
    equal to N. (#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] from Size[LessEqual[N]] to
    Size[Interval.Closed[_0, N]] and introduce the WitnessAs type class
    which unifies numeric type class instances that were split to work with
    literal singleton types and shapeless.Nat.
    (#473, #483)

Deprecations and removals

  • Deprecate Subtype and Supertype predicates because they lack
    practical relevance. (#432)
  • Deprecate ConstructorNames and FieldNames 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
    the types.time module. (#425)
  • Remove deprecated Refined#get method which has been replaced by
    Refined#value. (#426)
  • Deprecate scalacheck.util.Adjacent in favor of internal.Adjacent
    in the core module. (#475)
  • Deprecate scalacheck.util.Bounded in favor of api.{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

29 Jan 22:40
v0.8.7
4f4c14c
Compare
Choose a tag to compare

New features

  • Add MinValue and MaxValue to companions of numeric refined types
    via the new Min and Max type classes:
    scala> PosInt.MinValue
    res0: eu.timepit.refined.types.all.PosInt = 1
    
    scala> PosInt.MaxValue
    res1: eu.timepit.refined.types.all.PosInt = 2147483647
    Thanks to Howy Perrin! (#383)
  • Support Divisible[N] if N is a literal integral type. (#413)
  • Add floating-point refined types like PosDouble, NegDouble, and more
    to the eu.timepit.refined.types.numeric module.
    Thanks to Yuki Ishikawa! (#414)
  • Add IPv6 predicate for Strings.
    Thanks to Tim Steinbach! (#357)

Bug fixes

  • Fix Modulo predicate for large Long values by avoiding toDouble
    in its Validate instance. This also restricts the predicate to types
    with an Integral 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

30 Dec 21:28
v0.8.6
0a48129
Compare
Choose a tag to compare

New features

  • Add the validate method to companions of refined types to accumulate
    errors with cats.data.ValidatedNel. To use this method, syntax._
    from the refined-cats module needs to be imported like this:
    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)
    Thanks to Howy Perrin!
    (#382, #384)
  • Add the validate method using scalaz.ValidationNel also to the
    refined-scalaz module.
    Thanks to kusamakura! (#385)

New predicates

string

  • ValidInt: checks if a String is a parsable Int
  • ValidLong: checks if a String is a parsable Long
  • ValidDouble: checks if a String is a parsable Double
  • ValidBigInt: checks if a String is a parsable BigInt
  • ValidBigDecimal: checks if a String is a parsable BigDecimal

Thanks to kusamakura! (#379)

Performance improvements

  • Apply the optimization done in #334 also to macro calls that
    use RefineMacro.implApplyRef. Before this change, compilation time
    of e.g. PosInt(1) was one order of magnitude slower than 1: 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

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