Releases: fthomas/refined
0.5.0
Changes
-
Drop
case
inRefined
to prevent the creation of syntheticapply
andcopy
methods which subvert the private constructor.
Thanks to Dale Wijnand! (#160) -
Make parameter types of function literals in the
Eval
predicate
optional. This allows to writeval x: Int Refined Eval[W.`"x => x > 0"`.T] = 1
instead of
val y: Int Refined Eval[W.`"(x: Int) => x > 0"`.T] = 1
(#153)
-
Renamed
RefinePartiallyApplied.force
tounsafeFrom
and add
ApplyRefPartiallyApplied.unsafeFrom
. (#175) -
Add
Arbitrary
instance forEqual
. (#170) -
Add
scalaz.Equal
andscalaz.Show
instances for refined types.
These instances use the respective instances of the base types.
(#179) -
Update the documentation of the
numeric
module.
Thanks to John-Michael Reed!
Updates
- Update to Scala.js 0.6.10. (#155, #180)
- Update to shapeless 2.3.1. (#165)
- Update
refined-scalaz
to Scalaz 7.2.4. (#172, #178)
Released on 2016-06-17
0.4.0
Changes
-
Overwrite
Refined#toString
by delegating it to thetoString
method of the wrapped value. (#141) -
Add
RefType.applyRefM
, the the macro variant ofRefType.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
-
Fix the return type of
RefType.applyRef
. (#137) -
Use
Refined
instead of@@
inutil.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
Nand[A, B]
: negated conjunction of the predicatesA
andB
. (#140)Nor[A, B]
: negated disjunction of the predicatesA
andB
. (#143)
Init[P]
: checks if the predicateP
holds for all but the last element of aTraversable
. (#150)Tail[P]
: checks if the predicateP
holds for all but the first element of aTraversable
. (#150)
Thanks to Shohei Shimomura for all new predicates!
Updates
Released on 2016-04-10
0.3.7
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 torefined-scalacheck
to make the
numericArbitrary
instances more robust. This type class allows
to get rid offilter
calls in the numeric generators. (#135)
Released on 2016-03-12
0.3.6
0.3.5
0.3.4
0.3.3
Changes
- Add
Arbitrary
instances for numeric predicates indexed byNat
s and
improve the implementation of the other numericArbitrary
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 theRefineM
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
Changes
- Add a refined-scalaz subproject which provides a
RefType
instance
forscalaz.@@
(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 useMinute
as parameter forapplyRef
,
e.g.applyRef[Minute](45)
. (#78) - Add an
any
module which providesArbitrary
instances for any
refined type by using anArbitrary
of the base type and aValidate
of the refinement's predicate to pick only valid values. - Add
Arbitrary
instances forLessEqual
,GreaterEqual
, and
Whitespace
. - Add
checkArbitraryRefType
function to thescalacheck
package
object which can be used the checkArbitrary
instances of refined
types. (#87) - Remove the
Arbitrary
suffix from modules providingArbitrary
instances. - Rename
Interval
toInterval.Closed
. (#80)
New predicates
Eval[S]
: checks if a value applied to the predicateS
yieldstrue
(#82)
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
0.3.0
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 nowcase class Greater[N](n: N)
. This
allows predicates to be represented as values. - Add an ADT
Result[A]
which is eitherPassed
orFailed
that
represents the result of a validation against a type-level predicate.
AResult[A]
contains some value of typeA
which allows to have
arbitrary nested results. - Replace the
Predicate
type class withapi.Validate
.Validate
's
main function isvalidate(t: T): Result[R]
which checks ift
conforms to some type-level predicate.R
is an abstract type member
ofValidate
that represents the detail of the validation result.
For plain predicatesR
is the same type as the predicateP
.
For example,Validate[Int, Greater[W.
0.T]].validate(1)
will
returnPassed(Greater(0))
. - Rename
InferenceRule
toInference
and moveInference
,Refined
,
andRefType
into the newapi
package. - Rename the
implicits
object toauto
since the purpose of the
implicit conversions there is to automatically convert base types to
refined types. (#61) - Add
coflatMapRefine
toRefType
which is similar tocoflatMap
on
aComonad
. (#68) - Add
util.time
module with date- and time-related refined types
(Month
,DayOfMonth
,Hour
,Minute
, andSecond
). (#64)
Released on 2015-10-12