Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 27 16:43

    joroKr21 on main

    Update slf4j-nop to 2.0.5 (#129… (compare)

  • Nov 27 16:43
    joroKr21 closed #1293
  • Nov 26 17:38
    scala-steward opened #1293
  • Nov 24 22:35

    joroKr21 on main

    Update sbt-scalajs, scalajs-com… (compare)

  • Nov 24 22:35
    joroKr21 closed #1291
  • Nov 24 22:14
    joroKr21 synchronize #1291
  • Nov 24 22:13
    joroKr21 closed #1288
  • Nov 24 22:13

    joroKr21 on main

    Update junit-plugin, junit-runt… (compare)

  • Nov 24 22:13
    joroKr21 closed #1292
  • Nov 24 18:03
    scala-steward commented #1288
  • Nov 24 18:03
    scala-steward opened #1292
  • Nov 24 18:03
    scala-steward opened #1291
  • Nov 19 21:17

    joroKr21 on main

    Update slf4j-nop to 2.0.4 (#129… (compare)

  • Nov 19 21:17
    joroKr21 closed #1290
  • Nov 18 20:54
    scala-steward opened #1290
  • Nov 15 06:50
    joroKr21 commented #1286
  • Nov 15 06:48
    joroKr21 commented #1287
  • Nov 15 06:41
    joroKr21 synchronize #1288
  • Nov 15 06:41

    joroKr21 on main

    Update sbt to 1.8.0 (#1289) (compare)

  • Nov 15 06:41
    joroKr21 closed #1289
Alex Henning Johannessen
@ahjohannessen
@milessabin Awesome :) How would I go about defining a Typeable for cats.NonEmptyMap. In shapeless 2 I have something like:
  // Adapted from `shapeless.Typeable.genMapTypeable`.
  implicit def typeableForNonEmptyMap[K, V](
    implicit cM: ClassTag[NonEmptyMap[_, _]],
    tK: Typeable[K],
    tV: Typeable[V]
  ): Typeable[NonEmptyMap[K, V]] = new Typeable[NonEmptyMap[K, V]] {

    def cast(t: Any): Option[NonEmptyMap[K, V]] =
      if (t == null) None
      else if (cM.runtimeClass isAssignableFrom t.getClass) {
        val m = t.asInstanceOf[NonEmptyMap[Any, Any]]
        if (m.toSortedMap.forall(_.cast[(K, V)].isDefined)) Some(t.asInstanceOf[NonEmptyMap[K, V]]) else None
      } else None

    def describe = s"${cM.runtimeClass.getSimpleName}[${tK.describe}, ${tV.describe}]"
  }

}
Alex Henning Johannessen
@ahjohannessen
I get this:
[error] -- Error: /Users/ahjohannessen/Development/Work/subsidy-support/marshal/src/test/scala-3/support/marshal/typeables.scala:18:51 
[error] 18 |      val cm     = m.cast[NonEmptyMap[Int, String]]
[error]    |                                                   ^
[error]    |No Typeable for parametrized type cats.data.NonEmptyMapImpl.Type[scala.Int, scala.Predef.String]
[error]    | This location contains code that was inlined from typeables.scala:18
[error]    | This location contains code that was inlined from typeable.scala:244
Victor Viale
@Koroeskohr
hello friends ! I was wondering if there was a way to add a LUBConstraint to a ProductArgs output? I've been playing with it for a bit but I'm hitting a wall with the Dynamic method signature that's not being respected
+- what I'm trying to achieve
object foo extends ProductArgs {
  def applyProduct[L <: HList](l: L)(implicit LUBC: LUBConstraint[L, Bar]): Job[L] = Job(l)
}
Miles Sabin
@milessabin
Hi folks ... your occasional reminder that shapeless discussion has moved to the Typelevel Discord: https://discord.gg/bSQBZA3Ced
Victor Viale
@Koroeskohr
oh... thanks
Tharindu Galappaththi
@TharinduDG

When I'm trying to start a spark-shell(spark 3.0.1) with a custom jar I'm getting this error

java.lang.NoSuchMethodError: 'shapeless.DefaultSymbolicLabelling shapeless.DefaultSymbolicLabelling$.instance(shapeless.HList)'
  at com.cognite.sdk.scala.v1.GenericClient$anon$lazy$macro$5$1.inst$macro$1$lzycompute(Client.scala:202)
  at com.cognite.sdk.scala.v1.GenericClient$anon$lazy$macro$5$1.inst$macro$1(Client.scala:202)
  at com.cognite.sdk.scala.v1.GenericClient$.<init>(Client.scala:202)
  at com.cognite.sdk.scala.v1.GenericClient$.<clinit>(Client.scala)
  at cognite.spark.v1.DefaultSource$.$anonfun$getProjectFromAuth$1(DefaultSource.scala:393)
  at cats.effect.internals.IORunLoop$.step(IORunLoop.scala:302)
  at cats.effect.IO.unsafeRunTimed(IO.scala:338)
  at cats.effect.IO.unsafeRunSync(IO.scala:256)
  at cognite.spark.v1.DefaultSource$.getProjectFromAuth(DefaultSource.scala:396)
  at cognite.spark.v1.DefaultSource$.$anonfun$parseRelationConfig$4(DefaultSource.scala:315)
  at scala.collection.MapLike.getOrElse(MapLike.scala:131)
  at scala.collection.MapLike.getOrElse$(MapLike.scala:129)
  at org.apache.spark.sql.catalyst.util.CaseInsensitiveMap.getOrElse(CaseInsensitiveMap.scala:30)
  at cognite.spark.v1.DefaultSource$.parseRelationConfig(DefaultSource.scala:315)
  at cognite.spark.v1.DefaultSource.createRelation(DefaultSource.scala:89)
  at cognite.spark.v1.DefaultSource.createRelation(DefaultSource.scala:62)
  at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:344)
  at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:297)
  at org.apache.spark.sql.DataFrameReader.$anonfun$load$2(DataFrameReader.scala:286)
  at scala.Option.getOrElse(Option.scala:189)
  at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:286)
  at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:221)

I'm using circe 0.14.1 which seems to use shapeless 2.3.6.

I would appreciate any help to resolve this issue
Grigory
@pomadchin
@TharinduDG hey; shade shapeless in your project or bump the shapeless version up in the Spark class path
Georgi Krastev
@joroKr21
I didn't know Spark has Shapeless in the classpath
Grigory
@pomadchin
@joroKr21 yea they do have, that is a transitive dep
Both Spark 3.0 and 3.1 depend on some old shapeless version
that is also true for cats-kernel ):
Yuriy Badalyantc
@LMnet
Hi everybody. Why after MapValues I can't refer to the same field in the repr: https://scastie.scala-lang.org/LMnet/gENLvGZySJSr8Lg8zW4Vsw/7 ?
noti0na1
@noti0na1
noti0na1.png
Alberto Gregoris Herrero
@agregoris-zd
Hello everybody. Simple question, if I have a type type ValidatedFormat[T] = ValidatedNec[String, T] and a case class case class C(a: String, b: Int). is there any way to obtain a generic representation of type Repr = ValidatedFormat[String] :: ValidatedFormat[Int] :: shapeless.HNil?
nrktkt
@nrktkt:matrix.org
[m]

Hi there, I've got some code that isn't working (I assume due to some compiler implicit search depth limitations) and was hoping someone here could identify what might be going wrong.
Basically the code derives a typeclass to convert JSON AST to a domain case class. In the process it looks for annotations and default values on the fields.
The problem is that after about 32 simple fields recordFromJson (second link) stops resolving.

relevant code:
https://github.com/kag0/ninny-json/blob/defaults/ninny/src-2/io/github/kag0/ninny/FromJsonAutoImpl.scala
and
https://github.com/kag0/ninny-json/blob/defaults/ninny/src-2/io/github/kag0/ninny/VersionSpecificFromJsonInstances.scala

nrktkt
@nrktkt:matrix.org
[m]
ok, actually about 50 truly primitive fields, 32 with some options and types that require a deeper search
nrktkt
@nrktkt:matrix.org
[m]

:point_up: Edit: Hi there, I've got some code that isn't working (I assume due to some compiler implicit search depth limitations) and was hoping someone here could identify what might be going wrong.
Basically the code derives a typeclass to convert JSON AST to a domain case class.
The problem is that after about 32 simple fields recordFromJson (second link) stops resolving.

relevant code:
https://github.com/kag0/ninny-json/blob/0.4.3/ninny/src-2/io/github/kag0/ninny/FromJsonAutoImpl.scala
and
https://github.com/kag0/ninny-json/blob/0.4.3/ninny/src-2/io/github/kag0/ninny/VersionSpecificFromJsonInstances.scala

Sakib Hadžiavdić
@sake92
Anyone has idea about this one?
Grigory
@pomadchin
@sake92 hey, try the discord channel!
elyphas
@elyphas
Hi, someone could tell me, please, Why I get this error ?
value ->> is not a member of String
[error]   val ageChange = "age" ->> 22
I have this imports:
import shapeless._, record._, ops.record._, labelled._, syntax.singleton, tag._
elyphas
@elyphas
solved
anqit
@anqit
i just asked a question on stackoverflow about shapeless, but i figured i might get some more traction and a more knowledgable audience by cross posting here https://stackoverflow.com/questions/72906921/does-shapeless-play-well-with-type-members
i'd love some help, and happy to give more details/explanations/clarifications/etc if needed!
Sebastián Ortega
@sortega

Hello! Learning shapeless and trying to use mapValues with some record but the compiles doesn't find the Mapper / MapValues implicits.
This is the minimal repro with scala 2.13.8 and shapeless 2.3.9

import shapeless._
import shapeless.record._
import shapeless.PolyDefns.~>
import shapeless.syntax.singleton._

object MinimalRepro extends App {

  trait Param[A] {
    def upperBound: ParamMatcher[A]
  }

  sealed abstract class ParamMatcher[A]
  object ParamMatcher {
    case class MatchAny[A]() extends ParamMatcher[A]
  }

  case class UnboundedParam[A]() extends Param[A] {
    override def upperBound: ParamMatcher[A] = ParamMatcher.MatchAny()
  }

  val stringParam = UnboundedParam[String]()
  val intParam = UnboundedParam[Int]()

  object getUpperBound extends (Param ~> ParamMatcher) {
    override def apply[T](param: Param[T]): ParamMatcher[T] = param.upperBound
  }

  println(getUpperBound(stringParam)) // OK
  println(getUpperBound(intParam)) // OK

  println((stringParam :: intParam :: HNil).map(getUpperBound)) // KO
  println((("name" ->> stringParam) :: ("retries" ->> intParam) :: HNil).mapValues(getUpperBound)) // KO
}

Can you help me with what's wrong with this? Thanks

tpetillot
@tpetillot

Hi!
Is there a way to go:

type From = (Int => Foo) :+: (Int => Bar) :+: CNil
type To = Int => (Foo :+:  Bar :+: CNil)

Thanks!

Dmytro Mitin
@DmytroMitin
@tpetillot Use type class shapeless.ops.coproduct.Mapper or write coproduct.Comapped similar to shapeless.ops.hlist.Comapped
amf08006
@amf08006

I'm wondering if shapeless might be able to help me with a new use case. I have an app that passes around function calls.

def functionOne(var1: String, var2: Int, var3: CustomClassThatIsSerializable)
def functionTwo(functionOne)

Inside function two i was wondering if itd be possible to get the input parameters to function1 so i could serialize / capture them using a different library.

Dmytro Mitin
@DmytroMitin
@amf08006 What does def functionTwo(functionOne) mean? This is incorrect syntax. Do you mean call functionTwo(functionOne("abc", 10, CustomClassThatIsSerializable(...))) or higher-order functionTwo in call functionTwo(functionOne)? In the former case I guess you can try to make your functionTwo a macro.
nrktkt
@nrktkt:matrix.org
[m]
Are there any recommendations for ways to support scala 3 for a shapeless-using library?
Georgi Krastev
@joroKr21
Artur Soler
@artursoler
Hi, I have one function that transforms an HList in multiple ways, and thus it has a lot of type parameters and implicit evidence parameters (ZipWithIndex.Aux, Mapper.Aux, etc). Somewhere else, I have a class that contains an HList which will ultimately be passed onto this first function (the class is parameterized so the compiler knows the exact type of the HList). There is a chain of functions leading to this HList transformer function. The issue I'm finding is that the compiler is not able to generate the evidence parameters, and so it seems to me that I will need to receive and forward all of those types and evidence parameters along the call chain. Am I missing some "trick" to avoid having to pass those parameters all along?
Artur Soler
@artursoler
I see that discord is prefered now, I'll ask there