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
Fabio Labella
@SystemFw
ah ok wait
nope, that's not what I mean :)
but rather, given an ADT coproduct, how does the numbering work?
Andrew Roberts
@aroberts
This message was deleted
Fabio Labella
@SystemFw
e.g. the first case gets 0, and so on
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?