8000 Support for scala 3 "derives" syntax & union types · Issue #7467 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Support for scala 3 "derives" syntax & union types #7467
Open
@bertlebee

Description

@bertlebee

follow on from zio/zio-json#752 (comment)

The zio ecosystem doesn't currenly leverage the new scala 3 typeclass derivation machinery. The current pattern of adding implicits to all companion objects and calling Whatever.gen is maybe a necessary evil for scala 2, but there's no reason that I can see for it in scala 3!

Here's an example with zio-json. https://scastie.scala-lang.org/WjLoashcQxeOvxQ5JfRbTw

This is using an extension method but I think it'd be handy to roll this out across the ecosystem with a version specific trait that anything with a .gen method could extend. It would simply define def derived and delegate to the existing .gen method.

As part of this same issue, I think we should look to either depend on or subsume with attribution (ala izumi-reflect) this library into zio so that derivation works for union types https://github.com/iRevive/union-derivation.

Related: Typeclass derivation should now work on typeclasses with variance
scala/scala3#13146

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0