typelevel / typelevel/cats

cats.data.ValidatedNel issue

Open
#3,345 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
5.5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
5

Description

Hi all,

I am trying to run docker:publishLocal where I am faced with this error:


[error] /path/to/ClassA.scala:60:8: Cannot prove that cats.data.ValidatedNel[String,path.to.classB] <:< G[A].
[error]       .sequence
[error]        ^

Class A resides in project A, and classB is in project B, and they have this kind of structure:

|--projectName
        |-----project A
        |-----project B
|--build.sbt

The build.sbt looks like this:


lazy val projectA =
  project
    .in(file("projectName/projectA"))
    .enablePlugins(JavaAppPackaging, DockerPlugin)
    .dependsOn(ProjectRef(file("."), "projectB"))
    .settings(
        libraryDependencies ++= Seq("org.typelevel" %% "cats-core" % 2.1.0),
        scalacOptions += "-Ypartial-unification"
        ...
    )

lazy val projectB =
  project
    .in(file("projectName/projectB"))
    .dependsOn(ProjectRef(file("."), "anotherProject"))
    ...

I have researched around and I have added stuff like the "-Ypartial-unification", but to no avail:

plugins.sbt has this:

addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.2")
The method that is throwing the error is:


def apply(v1: (crwm, icrwm)): Boolean = {
    val (_, cri) = v1

    validationCriteria
      .map(_.validate(cri))
      .sequence
      .map(_ => cri)
      .toEither
      .fold(validationErrors => {
        log.warn(s"""
             |CR didn't pass quality check(s):
             |${validationErrors.toList.mkString("\n")}
           """.stripMargin)
        false
      }, _ => true)
  }

Sorry I have to obfuscate the methods. If it is unclear, please let me know and I will provide any info that I could.

I'm running sbt version 1.2.7

Thank you so much.

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

Start with the build.sbt project definitions and plugins.sbt, then run docker:publishLocal to reproduce the compiler error in ClassA.scala:60. Inspect the apply method's validate and sequence calls along with the Scala, Cats, and partial-unification settings. Done means identifying a confirmed cause and documenting a reproducible resolution, but the obfuscated code limits how directly a newcomer can proceed.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.