Skip to content

Releases: fthomas/refined

0.4.0

10 Apr 21:22
Compare
Choose a tag to compare

Changes

  • Overwrite Refined#toString by delegating it to the toString
    method of the wrapped value. (#141)

  • Add RefType.applyRefM, the the macro variant of RefType.applyRef.
    applyRefM is useful when working with type aliases for refined
    types and without any implicits, for example:

    scala> type Natural = Long Refined NonNegative
    defined type alias Natural
    
    scala> RefType.applyRefM[Natural](42L)
    res0: Natural = 42

    (#112, #138)

  • Fix the return type of RefType.applyRef. (#137)

  • Use Refined instead of @@ in util.string for refined types.

  • Remove the notion of "constant" Validate instances that allowed to
    refine non-literal values at compile-time. This feature hasn't proven
    to be useful after all. (#148)

  • Eval RefType during macro expansion again to minimize the runtime
    overhead of refinement types. (#149, #120)

  • Remove the deprecated implicits object. (#152)

New predicates

boolean

  • Nand[A, B]: negated conjunction of the predicates A and B. (#140)
  • Nor[A, B]: negated disjunction of the predicates A and B. (#143)

collection

  • Init[P]: checks if the predicate P holds for all but the last element of a Traversable. (#150)
  • Tail[P]: checks if the predicate P holds for all but the first element of a Traversable. (#150)

Thanks to Shohei Shimomura for all new predicates!

Updates

  • Update to Scala.js 0.6.8. (#136)
  • Update refined-scalaz to Scalaz 7.2.2. (#147)

Released on 2016-04-10

0.3.7

18 Mar 18:17
Compare
Choose a tag to compare

Changes

  • Update to Scala 2.11.8. (#134)
  • Update refined-scalaz to Scalaz 7.2.1 and build it for Scala.js.
    (#133)
  • Add an Adjacent type class to refined-scalacheck to make the
    numeric Arbitrary instances more robust. This type class allows
    to get rid of filter calls in the numeric generators. (#135)

Released on 2016-03-12

0.3.6

18 Mar 18:17
Compare
Choose a tag to compare

Changes

  • Update to shapeless 2.3.0. (#100)
  • Update to macro-compat 1.1.1. (#131)

Released on 2016-02-25

0.3.5

18 Mar 18:16
Compare
Choose a tag to compare

Changes

  • Update to Scala.js 0.6.7. (#129)
  • Update to scodec 1.9.0. (#130)

Released on 2016-02-13

0.3.4

18 Mar 18:15
Compare
Choose a tag to compare

Changes

  • Improve the compiler error message of invalid type inference of
    refined types. (#117, #126)
  • Remove macro code from RefType and do not eval RefType instances
    during macro expansion. (#120)
  • Update to Scala.js 0.6.6. (#127)

Released on 2016-02-03

0.3.3

18 Dec 21:46
Compare
Choose a tag to compare

Changes

  • Add Arbitrary instances for numeric predicates indexed by Nats and
    improve the implementation of the other numeric Arbitrary instances.
    Thanks to Jean-Rémi Desjardins! (#106, #109)
  • Add the RefType.refineMF macro which requires that the base type must
    be specified and cannot be inferred from its argument. This allows to
    define aliases for the RefineM macro where the base type and
    predicate are fixed. (#107)
  • Update refined-scalaz to Scalaz 7.2.0

Released on 2015-12-18

0.3.2

18 Nov 19:13
Compare
Choose a tag to compare

Changes

  • Add a refined-scalaz subproject which provides a RefType instance
    for scalaz.@@ (Scalaz' tag type). (#84)
  • Add a refined-scodec subproject which provides scodec.Codec
    instances for refined types. (#92)
  • Add RefType.applyRef function that refines a value according to a
    refined type. This makes working with type aliases like
    type Minute = Int Refined Interval[W.0.T, W.59.T] more
    convenient because one can use Minute as parameter for applyRef,
    e.g. applyRef[Minute](45). (#78)
  • Add an any module which provides Arbitrary instances for any
    refined type by using an Arbitrary of the base type and a Validate
    of the refinement's predicate to pick only valid values.
  • Add Arbitrary instances for LessEqual, GreaterEqual, and
    Whitespace.
  • Add checkArbitraryRefType function to the scalacheck package
    object which can be used the check Arbitrary instances of refined
    types. (#87)
  • Remove the Arbitrary suffix from modules providing Arbitrary
    instances.
  • Rename Interval to Interval.Closed. (#80)

New predicates

generic

  • Eval[S]: checks if a value applied to the predicate S yields true (#82)

numeric

  • Interval.Open[L, H]: checks if a numeric value is in the interval (L, H)
  • Interval.OpenClosed[L, H]: checks if a numeric value is in the interval (L, H]
  • Interval.ClosedOpen[L, H]: checks if a numeric value is in the interval [L, H)
  • Interval.Closed[L, H]: checks if a numeric value is in the interval [L, H]

Released on 2015-11-18

0.3.1

18 Nov 19:15
Compare
Choose a tag to compare

Changes

  • Add a refined-scalacheck subproject which provides
    ScalaCheck Arbitrary instances of refined types for
    some of refined's predicates. (#58)

Released on 2015-10-17

0.3.0

18 Nov 19:15
Compare
Choose a tag to compare

Changes

  • Support Scala 2.10. Thanks to Alexandre Archambault! (#51)
  • Change all predicates so they can hold values of their parameters,
    e.g. trait Greater[N] is now case class Greater[N](n: N). This
    allows predicates to be represented as values.
  • Add an ADT Result[A] which is either Passed or Failed that
    represents the result of a validation against a type-level predicate.
    A Result[A] contains some value of type A which allows to have
    arbitrary nested results.
  • Replace the Predicate type class with api.Validate. Validate's
    main function is validate(t: T): Result[R] which checks if t
    conforms to some type-level predicate. R is an abstract type member
    of Validate that represents the detail of the validation result.
    For plain predicates R is the same type as the predicate P.
    For example, Validate[Int, Greater[W.0.T]].validate(1) will
    return Passed(Greater(0)).
  • Rename InferenceRule to Inference and move Inference, Refined,
    and RefType into the new api package.
  • Rename the implicits object to auto since the purpose of the
    implicit conversions there is to automatically convert base types to
    refined types. (#61)
  • Add coflatMapRefine to RefType which is similar to coflatMap on
    a Comonad. (#68)
  • Add util.time module with date- and time-related refined types
    (Month, DayOfMonth, Hour, Minute, and Second). (#64)

Released on 2015-10-12

0.2.3

01 Sep 18:36
Compare
Choose a tag to compare

Changes

  • Add an implicit conversion from refined types to their base types. (#55)
  • Equal[N <: Nat] can now be used with all types that have a Numeric
    instance. This allows types like Double @@ Not[Equal[_0]].
  • Add an inference rule to go from Equal[N <: Nat] to any numeric predicate.
  • Remove deprecated refine, refineLit, and refineM.
  • Update to Scala.js 0.6.5.