These are chat archives for non/algebra

24th
Apr 2016
Erik Osheim
@non
Apr 24 2016 04:48
@kailuowang ok 0.4.0 is released to sonatype
should be available from maven central in a few hours
i'm updating the README now
ok, pr to update readme is here: non/algebra#150
Adelbert Chang
@adelbertc
Apr 24 2016 07:37
:sparkles:
Kai(luo) Wang
@kailuowang
Apr 24 2016 12:08
@non thanks very much. PR for updating cats is in.
Erik Osheim
@non
Apr 24 2016 12:23
thanks!
Merlijn Boogerd
@mboogerd
Apr 24 2016 14:31

Good day all; I have a question regarding testing a lattice law with discipline. Most of my law-testing actually goes smoothly, with the exception of serializability for the following algebra (version: 0.3.1) bounded join-semilattice:

case object 

implicit case object SingletonLattice extends BoundedJoinSemilattice[⊥.type] {
    override def join(lhs: ⊥.type, rhs: ⊥.type): ⊥.type = ⊥
    override def zero: ⊥.type = ⊥
  }

The code compiles and runs just fine, and is serializable itself. However, if I test the laws against it, it fails with java.lang.NoSuchFieldException: serialVersionUID for instance algebra.lattice.BoundedJoinSemilattice$$anon$5. I'm not so sure how to work around this, and I was hoping one of you might have an idea?

For the sake of giving all the possibly relevant details:
My test boils down to: checkAll("⊥", LatticeLaws[⊥.type].boundedJoinSemilattice)
And my Arbitrary instance: implicit val arbitraryBottom: Arbitrary[⊥.type] = Arbitrary(⊥)
Erik Osheim
@non
Apr 24 2016 15:07
huh, interesting.
what happens if your extends Serializable explicitly?
errr, i mean, your SingletonLattice object
(the serializability test is testing the type class, not the value )
that's really strange :/
Cody Allen
@ceedubs
Apr 24 2016 15:11
@mboogerd which version of scala are you using? It looks like there might have been a related regression early in the 2.11 series: https://issues.scala-lang.org/browse/SI-8549?focusedCommentId=69301&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-69301
gotta run. Best of luck.
Erik Osheim
@non
Apr 24 2016 15:13
huh, yeah, that could be it
i confirmed that algebra.lattice.BoundedJoinSemilattice$$anon$5 refers to the anonymous class created at: https://github.com/non/algebra/blob/master/lattice/src/main/scala/algebra/lattice/BoundedJoinSemilattice.scala#L10
but if @mboogerd is using 2.11.0 then the regression seems more likely
Merlijn Boogerd
@mboogerd
Apr 24 2016 15:42
I am using Scala 2.11.8 indeed
Erik Osheim
@non
Apr 24 2016 15:43
hmm ok
Merlijn Boogerd
@mboogerd
Apr 24 2016 15:44
reading up on the issue right now
Merlijn Boogerd
@mboogerd
Apr 24 2016 15:49
if I understand correctly, that issue was fixed in 2.11.1, thanks for the hint nonetheless!
I also tried explicitly extending Serializable, unfortunately didn't change the test result
Erik Osheim
@non
Apr 24 2016 16:07
what happens if you extend BoundedSemilattice instead?
(i.e. is this specific to BoindedJoinSemilattice or a more general problem?)
Merlijn Boogerd
@mboogerd
Apr 24 2016 16:09
FWIW, I tried going to 2.11.1 (just to verify that there wasn't another regression since). Much to my confusion, now my Int join-semilattice has its serializability failing the test as well. The Boolean bounded join-semilattice however, is still serializable. These two lattices' setup are identical with the exception of the type.
I will given that a try @non
(although the former leads me to believe that is not the case)
Erik Osheim
@non
Apr 24 2016 16:11
huh. that's really confusing.
one other thought, try defining these as classes instead of case objects?
(it's not ideal due to the extra boilerplate but i wonder if that is having an effect somehow)
Merlijn Boogerd
@mboogerd
Apr 24 2016 16:14
I now have the following, identical result:
case object 

  class SingletonLattice extends BoundedJoinSemilattice[⊥.type] with Serializable {
    override def join(lhs: ⊥.type, rhs: ⊥.type): ⊥.type = ⊥
    override def zero: ⊥.type = ⊥
  }
  implicit val singleTonLattice: BoundedJoinSemilattice[⊥.type] = new SingletonLattice
Erik Osheim
@non
Apr 24 2016 16:15
same error?
Merlijn Boogerd
@mboogerd
Apr 24 2016 16:16
let me verify (it doesn't show in the output, have to debug)
same error indeed
Erik Osheim
@non
Apr 24 2016 16:19
ugh ok. so -- i have to run, but i'm going to be working in this codebase later today and i'll try to get to the bottom of this.
sorry it's affecting you! do you know if this is limited to master and 0.4.0, or do you see it with 0.3.1 too?
Merlijn Boogerd
@mboogerd
Apr 24 2016 16:20
ah, amazing, thanks for the help thus far!!
I only checked with 0.3.1 (as a transitive dependency from cats 0.4.1)
I will check meanwhile with 0.4.0 and let you know
Erik Osheim
@non
Apr 24 2016 16:20
ok right that makes sense. i'll check it myself but yeah if you do just let me know here what you see. i'll ping you if i get anything working.
thanks!
Merlijn Boogerd
@mboogerd
Apr 24 2016 16:21
thanks to you! :)
Kai(luo) Wang
@kailuowang
Apr 24 2016 22:51
non/algebra#151 need another maintainer