Returns a new Normalization
that composes this and the passed Normalization
.
Returns a new Normalization
that composes this and the passed Normalization
.
The normalized
method of the Normalization
returned by this method returns a normalized form of the passed
object obtained by forwarding the passed value first to this Normalization
's normalized
method,
then passing that result to the other Normalization
's normalized
method.
Essentially, the body of the composed normalized
method is:
normalizationPassedToAnd.normalized(normalizationOnWhichAndWasInvoked.normalized(a))
a Normalization
to 'and' with this one
a Normalization
representing the composition of this and the passed Normalization
Converts this Normalization
to a NormalizingEquivalence[A]
whose normalized
method delegates to this Normalization[A]
and whose afterNormalizationEquivalence
field returns the
implicitly passed Equivalence[A]
.
Converts this Normalization
to a NormalizingEquivalence[A]
whose normalized
method delegates to this Normalization[A]
and whose afterNormalizationEquivalence
field returns the
implicitly passed Equivalence[A]
.
the Equivalence
that the returned NormalizingEquivalence
will delegate to determine equality after normalizing both left and right (if appropriate) sides.
Defines a custom way to normalize instances of a type.
For example, to normalize
Double
s by truncating off any decimal part, you might write:Given this definition you could use it with the
Explicitly
DSL like this:Note that to use a
Normalization
with theExplicitly
DSL, you'll need to useTypeCheckedTripleEquals
. If you're just using plain-oldTripleEquals
, you'll need aUniformity
, aNormalization
subclass.If you make the
truncated
val
implicit and import or mix in the members ofNormMethods
, you can access the behavior by invoking.norm
onDouble
s.the type whose normalization is being defined