typelevel / typelevel/shapeless-3

Support Mirror.Sum for union types

Open
#21 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Scala
Stars
204
Forks
24
Avg merge
4h 5m
Merged PRs (30d)
1

Description

type Color = "Brown" | "White" | "Yellow" | "Black"
given Encoder[Color] = Encoder.derived
inline def derived[T](using gen: K0.Generic[T]): Encoder[T] =
  gen.derive(product, coproduct)

[error] 19 |  given Encoder[Color] = Encoder.derived
[error]    |                                        ^
[error]    |     no implicit argument of type shapeless3.deriving.K0.Generic[
[error]    |       (("Brown" : String) | ("White" : String) | ("Yellow" : String) |
[error]    |         ("Black" : String)
[error]    |       )
[error]    |     ] was found for parameter gen of method derived in object Encoder

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to Encoder.derived and shapeless3.deriving.K0.Generic; start by tracing how the shown derivation handles coproducts and Scala union types. Done means the Color example compiles with Encoder.derived and the behavior is covered by the project's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.