Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Kai(luo) Wang
@kailuowang
@edmondo1984 1.0.0-M7 Cats 0.8
Kai(luo) Wang
@kailuowang
@milessabin get a chance to take a look at #83? Once this is merged, I can go ahead and restore all full-auto derivations and make final RC release I think
Ryan Williams
@ryan-williams

hello, i'm trying to upgrade from RC0 to RC2.

In RC0 I have a test Suite base class that mixes in cats.derived.MkEqDerivation, so that all subclasses have auto-derivation of Eq instances

Poking around RC2, it seems like there is only the object cats.derived.MkEq, but no trait i can mix-in, meaning i'd have to say:

import cats.derived.MkEq._

in each of my Suite subclasses to get the same behavior.

do i have that right / is there a trait i can mix in?

seems unfortunate; changing private[derived] abstract class to trait here (and on line 52 below) would "fix" it, i think?
Ryan Williams
@ryan-williams

tried making that change, test and publishLocal seem fine with it in kittens, but at the point that I try to mix in MkEqDerivation downstream I get compile error:

class MkEqDerivation in package derived cannot be accessed in package cats.derived

which is puzzling because 1) MkEqDerivation is now public, and 2) i'm not trying to access it from cats.derived but from my own package

so maybe there's more going on here than i'm grokking

Ryan Williams
@ryan-williams
copy-pasting my modified eq.scala into my own project makes that error go away, perhaps i had a bad incremental compiler state (seems unlikely, i tried the above with cleans everywhere), or kittens has a compiler plugin that is modifying the generated bytecode, or something else?
Georgi Krastev
@joroKr21
@ryan-williams Those should not be exposed to the user, because they cause problems:
  1. They trump existing instances.
  2. Or they cause ambiguity with existing instances.
For these reasons full auto derivations was deprecated but there is ongoing work to bring it back: #82
It's a good idea to expose it in traits though and also to have a derived.all object
Matija Folnovic
@mfolnovic
hello! could someone help me understand why this doesn't compile?
object FoldableTest {
  sealed trait LList[+T]
  case object LNil extends LList[Nothing]
  case class LCons[T](x: T, xs: LList[T]) extends LList[T]

  val functor = cats.derive.functor[LList] // compiles
  val foldable = cats.derive.foldable[LList] // doesn't compile
}
Matija Folnovic
@mfolnovic
I assume it's because there's "Further induction step for products" part missing in foldable derivation?
Georgi Krastev
@joroKr21
It looks like it
Matija Folnovic
@mfolnovic
i'll have PR ready in a few moments ;)
Matija Folnovic
@mfolnovic
milessabin/kittens#84 :)
also, were there any major performance boosts from RC1 to RC2? seems like I don't have issues I had a month ago with huge adt (60+ subclasses), which is amazing! :muscle:
Kai(luo) Wang
@kailuowang
@mfolnovic nice to hear, which type class did you get the performance boost?
Matija Folnovic
@mfolnovic
@kailuowang I'm not exactly sure tbh, I have one ADT with ~20 subclasses which I couldn't derive all at once before (but now I can), and my IDEA crashed when I experimented with 60+ subclasses (but, after debugging, it was for another reason...), so I didn't really test this yet :sweat_smile:
Kai(luo) Wang
@kailuowang
which type class are you able to derive for the 20 subclasses one?
Matija Folnovic
@mfolnovic
Functor and Foldable
Olli Helenius
@liff
would it be possible to have some kind of @deriving(Show, Eq) to do semiauto with?
Kai(luo) Wang
@kailuowang
@liff with the current release, you can do
implicit val showM : Show[MyType] = cats.derive.show[MyType]
with the next release you need to use
implicit val showM : Show[MyType] = cats.derived.semi.show[MyType]
need to write the same for Eq
Kai(luo) Wang
@kailuowang
@milessabin do you have time for milessabin/kittens#85 or you want to indulge me with your trust again?
Miles Sabin
@milessabin
@kailuowang I totally trust you :-)
Kai(luo) Wang
@kailuowang
thanks !
I’ll merge and release
Miles Sabin
@milessabin
👍
Olli Helenius
@liff
@kailuowang yeah, i was thinking it could be nice to be able to hide all that noise behind an annotation
lots of noise just to get an Eq or Show instance for some case class :)
Kai(luo) Wang
@kailuowang
it certainly is more typing than an annotation. I am open to a new kittens-macro module that generates the 2 lines of implicit val code using an annotation. If you are interested, submit an issue or maybe even better a PR? :wink:
Julien Jean Paul Sirocchi
@sirocchj
hi all! any news on when to expect a 1.0.0 release?
Kai(luo) Wang
@kailuowang
I think we are ready for a 1.0.0, WDYT @milessabin @joroKr21 ?
Georgi Krastev
@joroKr21
If we're done with #82 I'd say yes :tada:
It's been a while and I'm not sure what the status is there
Kai(luo) Wang
@kailuowang
they are all restored. we switched to a new organization of our API in the last release.
Julien Jean Paul Sirocchi
@sirocchj
:shipit: :smile:
Miles Sabin
@milessabin
Go for it!
Viktor Lövgren
@vlovgr

I've got a POC for a ShowPretty derivation in kittens, which instead of this:

People(name = Mike, contactInfo = ContactInfo(phoneNumber = 202-295-3928, address = 1 Main ST, Chicago, IL))

instead generates the following.

People(
  name = Mike,
  contactInfo = ContactInfo(
    phoneNumber = 202-295-3928,
    address = 1 Main ST, Chicago, IL
  )
)

@kailuowang should I open a pull request?

Kai(luo) Wang
@kailuowang
@vlovgr +1 from me. I like it.
Viktor Lövgren
@vlovgr
@kailuowang opened #95
Kai(luo) Wang
@kailuowang
thanks!
Luciano
@lJoublanc
Is there any obstacle to creating a Sequencer[C <: Coproduct]? I find myself in need of one but it doesn't exist.
Kai(luo) Wang
@kailuowang
@lJoublanc I don’t see any. Probably easier to write than Product
Miles Sabin
@milessabin
Everyone on this channel should move over to: https://gitter.im/typelevel/kittens
I thought that transferring the repo would transfer the channel, but I guess not ...
Michael Stokley
@mastokley_gitlab
i'm a beginner and i'm trying to use the eq from kittens. what do i need to import and do i need to import at the callsite of .===?
the documentation suggests i import import cats.derived i think but that is failing for me