You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Then, mixin `DiffxAssertions` trait or add `import com.softwaremill.diffx.utest.DiffxAssertions._` to your test code.
@@ -169,13 +193,11 @@ implicit val modifiedDiff: Diff[Person] = Derived[Diff[Person]].ignore[Person,St
169
193
170
194
## Customization
171
195
172
-
If you'd like to implement custom matching logic for the given type, create an implicit `Diff` instance for that
196
+
If you'd like to implement custom matching logic for the given type, create an implicit `Diff` instance for that
173
197
type, and make sure it's in scope when any `Diff` instances depending on that type are created.
174
198
175
-
If there is already a typeclass for a particular type, but you would like to use another one, you wil have to override existing instance. Because of the "exporting" mechanism the top level typeclass is `Derived[Diff]` rather then `Diff` and that's the typeclass you need to override.
176
-
177
-
To understand it better, consider following example with `NonEmptyList` from cats.
178
-
`NonEmptyList` is implemented as case class so diffx will create a `Derived[Diff[NonEmptyList]]` typeclass instance using magnolia derivation.
199
+
Consider following example with `NonEmptyList` from cats. `NonEmptyList` is implemented as case class so diffx
200
+
will create a `Diff[NonEmptyList]` typeclass instance using magnolia derivation.
179
201
180
202
Obviously that's not what we usually want. In most of the cases we would like `NonEmptyList` to be compared as a list.
181
203
Diffx already has an instance of a typeclass for a list. One more thing to do is to use that typeclass by converting `NonEmptyList` to list which can be done using `contramap` method.
@@ -184,18 +206,18 @@ The final code looks as follows:
0 commit comments