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
where `SomeCaseClass`, `AnotherCaseClass`, `fooDerivation`, `barDerivation` are some objects, extending one of the `InstanceDef` traits ([see module source](https://github.com/tofu-tf/derevo/blob/supertagged/core/src/main/scala/derevo/package.scala#L13:L21)).
17
+
where `SomeCaseClass`, `AnotherCaseClass`, `fooDerivation`, `barDerivation` are some objects, extending one of the `InstanceDef` traits ([see module source](https://github.com/tofu-tf/derevo/blob/master/modules/core/src/main/scala/derevo/package.scala#L20:L29)).
18
18
19
19
For every element of the `@derive` macro, there will be generated `implicit val` or `implicit def` (when `Foo` has type parameters) providing the corresponding typeclass.
20
20
For simple type derivation, if `Foo` has type parameters, the instance will require an instance of the same or specified other typeclass for proper derivation.
@@ -34,7 +34,7 @@ If you have problems with the initialization order you can optionally put the
34
34
35
35
36
36
## Making your own derivation.
37
-
First, extend the object (the companion object for your type is the best option) from one of the [`InstanceDef` traits](https://github.com/tofu-tf/derevo/blob/supertagged/core/src/main/scala/derevo/package.scala#L13:L21).
37
+
First, extend the object (the companion object for your type is the best option) from one of the [`InstanceDef` traits](https://github.com/tofu-tf/derevo/blob/master/modules/core/src/main/scala/derevo/package.scala#L20:L29).
38
38
39
39
Then implement the `instance` method for your object so it could derive the corresponding instance.
Also, you can define additional methods `def apply(...)` or `def foo(...)` in your derivation object. This will allow instance creation as
52
52
`@derive(TypeClass(...))` or `@derive(TypeClass.foo(...))`.
53
53
54
-
To support `newtype` derivation, extend your object with (`NewtypeDerivation`)[https://github.com/tofu-tf/derevo/blob/master/core/src/main/scala/derevo/NewTypeRepr.scala#L8]. Alternatively, your object may have the `newtype[R]` method with a single type parameter that receives the underlying type and returns another object that has the `instance` method that works as described earlier.
54
+
To support `newtype` derivation, extend your object with [`NewtypeDerivation` trait](https://github.com/tofu-tf/derevo/blob/master/modules/core/src/main/scala/derevo/NewTypeRepr.scala#L8). Alternatively, your object may have the `newtype[R]` method with a single type parameter that receives the underlying type and returns another object that has the `instance` method that works as described earlier.
55
55
56
56
Sometimes, the required constraint may differ from the provided typeclass, e.g. `circe.Encoder` which requires
57
57
`Encoder` for each field but provides `Encoder.AsObject` for the target case class.
@@ -80,7 +80,7 @@ This works by adding the `@delegating` annotation to your delegator object:
80
80
@delegating("full.qualified.method.path")
81
81
```
82
82
Then call `macro Derevo.delegate`, `macro Derevo.delegateParams`, `macro Derevo.delegateParams2` or `macro Derevo.delegateParams3` in the corresponding methods.
83
-
An example can be found [here](https://github.com/tofu-tf/derevo/blob/supertagged/circe/src/main/scala/derevo/circe/circe.scala).
83
+
An example can be found [here](https://github.com/tofu-tf/derevo/blob/master/modules/circe/src/main/scala/derevo/circe/circe.scala).
0 commit comments