Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 29 14:47

    joroKr21 on main

    Massively simplify build - R… Merge branch 'main' into rebuild Merge pull request #1275 from j… (compare)

  • Sep 29 14:47
    joroKr21 closed #1275
  • Sep 20 00:39
    joroKr21 synchronize #1273
  • Sep 20 00:39
    joroKr21 synchronize #1275
  • Sep 19 22:08

    joroKr21 on main

    Update scala-compiler, scala-li… Merge branch 'main' into update… Merge pull request #1278 from s… (compare)

  • Sep 19 22:08
    joroKr21 closed #1278
  • Sep 19 22:00
    joroKr21 synchronize #1278
  • Sep 19 21:59

    joroKr21 on main

    Update sbt-scalajs, scalajs-com… Merge branch 'main' into update… Merge pull request #1277 from s… (compare)

  • Sep 19 21:59
    joroKr21 closed #1277
  • Sep 19 21:52
    joroKr21 synchronize #1277
  • Sep 19 21:51

    joroKr21 on main

    Update sbt-mima-plugin to 1.1.1 Merge pull request #1276 from s… (compare)

  • Sep 19 21:51
    joroKr21 closed #1276
  • Sep 19 19:18
    scala-steward opened #1278
  • Sep 19 19:17
    scala-steward opened #1277
  • Sep 19 19:17
    scala-steward opened #1276
  • Sep 17 20:23
    joroKr21 assigned #1275
  • Sep 17 20:23
    joroKr21 review_requested #1275
  • Sep 17 20:23
    joroKr21 labeled #1275
  • Sep 17 20:08
    joroKr21 opened #1275
  • Sep 17 19:03
    joroKr21 synchronize #1273
Andrew Roberts
@aroberts
  implicit val serializeCNil: MsgpackIndexed[CNil] = new MsgpackIndexed[CNil] {
    def packIndexed(index: Int, v: CNil) = Attempt.failure(Err(s"CNil can't be packed: $v"))
    def unpackIndexed(index: Int, v: MessagePack) = Attempt.failure(Err(s"CNil can't be unpacked: $v"))
  }

  implicit def serializeCCons[H, T <: Coproduct](implicit
      hSer: Msgpack[H],
      tSer: MsgpackIndexed[T]
  ): MsgpackIndexed[H :+: T] = new MsgpackIndexed[H :+: T] {
    def packIndexed(index: Int, v: H :+: T) = v match {
      case Inl(h) => hSer.pack(h).map((index, _))
      case Inr(t) => tSer.packIndexed(index + 1, t)
    }

    def unpackIndexed(index: Int, v: MessagePack) = index match {
      case 0 => hSer.unpack(v).map(Inl(_))
      case n => tSer.unpackIndexed(n - 1, v).map(Inr(_))
    }
  }
Is that what you mean? it’s basically a count of how many Inr cases are processed before an Inl instance is encountered
Fabio Labella
@SystemFw
yes
what's the problem with it?
Andrew Roberts
@aroberts
nothing, as far as I can tell
Fabio Labella
@SystemFw
ah
Andrew Roberts
@aroberts
the issue is a derivation problem
auto derivation after invocation
Fabio Labella
@SystemFw
I don't follow
(sorry, I thought you were still stuck on the above, but the approach I was going to suggest is what you already have :) )
mm actually wait
Andrew Roberts
@aroberts
 it should "derive Msgpack instances for sealed ADTs" in {
    implicit val childSer: Msgpack[Family.Child] = deriveMsgpack
    implicit val parentSer: Msgpack[Family.Parent] = deriveMsgpack

    implicit val ser: Msgpack[Family] = deriveMsgpack
}
this block doesn’t compile when I comment out the first two implicits
but with them in place, it compiles just fine
Fabio Labella
@SystemFw
do you have Coproduct instances for MagPack?
Andrew Roberts
@aroberts
yeah, pasted above
serializeCNil and serializeCCons
Fabio Labella
@SystemFw
those are MsgPackIndexed, not MsgPack
Andrew Roberts
@aroberts
that spec says to me that when I’m constructing a DerivedMsgpack instance for Family, the derive code isn’t able to reach into the Repr of Family and derive missing Msgpack instances
MsgpackIndexed <: Msgpack
Fabio Labella
@SystemFw
welcome to the beautiful world of mixing implicits and sub typing :)
Andrew Roberts
@aroberts
also, the spec I pasted above wouldn’t compile if I didn’t have coproduct implicits
so I’m confident those are getting found
I think it’s an implicit resolution problem
hah- yeah pretty awesome...
Fabio Labella
@SystemFw
can you the[MsgPack[Int :+: CNil]]
Andrew Roberts
@aroberts
let’s see...
yep
Fabio Labella
@SystemFw
right , at this point I can only help you if you give me a link to the full code I'm afraid
does it work if you put everything in the companion btw?
Andrew Roberts
@aroberts
not sure, give me a minute
Andrew Roberts
@aroberts
it breaks other stuff
Fabio Labella
@SystemFw
Personally, I'd pause and try and get it to work end-to-end without the semiauto machinery
by having everything in the companion
David Hoyt
@davidhoyt
@SystemFw yes, I was starting to go down the flatten path. I need this for labelled generics not basic (generic) products, so I tried to evolve the flatten example without much luck so far.
Fabio Labella
@SystemFw
I was doing it, but I hit an unrelated bug
I got a working version for Generic very quickly
but it didn't work for LabelledGeneric
which is really surprising, so I kept minimising and I think I've hit something that looks like a compiler bug
just posted in the scala room
David Hoyt
@davidhoyt
@SystemFw not surprised in the least. to make matters worse, I am needing it to work w/ shapeless 2.2.5 on scala 2.10 and 2.11 actually.
Fabio Labella
@SystemFw
oh, have fun :)
David Hoyt
@davidhoyt
i need a "miserable" emoji :D
Fabio Labella
@SystemFw
by "not work with LabelledGeneric" I meant they both compiled, but exhibited different behaviour
which it never happened to me with shapeless before, and I would say I'm fairly experienced with it
David Hoyt
@davidhoyt
@SystemFw do you mind pasting what you have in a scala fiddle or elsewhere?
Fabio Labella
@SystemFw
@davidhoyt what do you want exactly? the working version with Generic and the non-working one with LabelledGeneric?
David Hoyt
@davidhoyt
non-working one with labelled generic
Fabio Labella
@SystemFw
ah, I've deleted it, let me see if I can redo it
I had two versions, one with Poly, one with custom typeclasses
let me redo the one with Poly, it's shorter