Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Scala 3 regression: derivation error for value classes

未关闭
#658 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
scala

调研方向

首先,使用提供的 kittens 3.3.0 代码片段重现 Scala 3 的失败,并将其与 Scala 2.13 的行为进行比较。调查 semiauto.monoid[MyString] 以及建议的 DerivedMonoid.Strict.product import;当 value-class derivation 在 Scala 3 上成功且不再出现缺少 ProductGeneric 的错误时,该 issue 即完成。

由索引模型根据 Issue 内容生成。

描述

Blocked/needs help Bug
"org.typelevel" %% "kittens" % "3.3.0"
import cats.derived._
case class MyString(value: String) extends AnyVal
semiauto.monoid[MyString]

this snippet compiles successfully on Scala 2.13, but fails on Scala 3:

No given instance of type cats.derived.DerivedMonoid[Playground.MyString] was found.
I found:

    cats.derived.DerivedMonoid.given_DerivedMonoid_A[Playground.MyString](
      shapeless3.deriving.K0.mkProductInstances[
        [A] =>> cats.derived.Derived.Or[cats.kernel.Monoid[A]], Playground.MyString]
        (
        /* missing */
          summon[shapeless3.deriving.K0.ProductGeneric[Playground.MyString]]
      )
    )

But Failed to synthesize an instance of type shapeless3.deriving.K0.ProductGeneric[Playground.MyString]: class MyString is not a generic product because it is a value class.

The following import might make progress towards fixing the problem:

  import cats.derived.DerivedMonoid.Strict.product

Scastie: https://scastie.scala-lang.org/DqVORi3bSU6rB8JM0PupHw

主要语言
Scala
星标
545
派生
66
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

typelevel/kittens 的其他 Issue

查看 typelevel/kittens 的全部 Issue

相似的 Issue

更多 Scala Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。