Where communities thrive


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

    joroKr21 on main

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

  • 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
Fabio Labella
@SystemFw
the problem is that you hit some bugs sometimes (pretty weird ones)
probably dotty will require explicit signatures for implicits though
Tim Spence
@TimWSpence
Cool, thanks!
Miles Sabin
@milessabin
Aux is the way to go.
It's still needed in Dotty I'm afraid.
It would be good to come up with a way to avoid it.
Fabio Labella
@SystemFw
I'm actually worried about how obscure things will be with the new given syntax and so on
we don't need Aux as much though, right? if parameters can depend on each other within lists
Miles Sabin
@milessabin
There's that. But the other use of Aux to abbreviate duplicated type member declarations in result types doesn't go away.
Fabio Labella
@SystemFw
yeah that makes sense
however perhaps you can just write the full refinement in that case, it's not that big of a deal if only the return type is affected. I think what confuses people about Aux is the prolog style it forces when thinking about your type params, mostly
and that is fixed if you can do (implicit gen: Generic[A], foo: Foo[gen.Repr])
although again, I wonder how that works with the new syntax
Tim Spence
@TimWSpence
Thanks @SystemFw and @milessabin - it (finally) worked! :)
Miles Sabin
@milessabin

although again, I wonder how that works with the new syntax

I'd need to check, but I'm pretty sure it works in much the same way.

Fabio Labella
@SystemFw
:+1:
Ben Kyrlach
@bkyrlach

With the help of the kind folks on here, I finally got some code that works. If anyone was extremely bored and wanted to provide some feedback, I'm sure there's plenty of improvements that could be made.

https://gist.github.com/bkyrlach/cf8ea12ded3c6fb07c14d9c00b33a818
https://gist.github.com/bkyrlach/2ba7fcad87e780e9958c34f898beb468

PhillHenry
@PhillHenry

I suspect this is a silly question: it appears that the values given to create a shapeless.Sized need to be explicitly typed in by the programmer. Is there any way to make this more flexible - perhaps with values pulled from a more dynamic source...?

I'm guessing the answer is 'no' but since Shapeless does things I never thought would be possible, it's worth asking the question.

Fabio Labella
@SystemFw
the answer is no
well, maybe you can read from a file during a macro or something, but basically it needs to be known statically when you compile
this is a general point with what Scala can and cannot do: when you build a typed model, all you can do is then dynamically check if something adheres to that model, but not infer the model dynamically
example, let's say you build a typed schema with shapeless. Most of your code will have compile time guarantees about it
at the edge of your code you can say "I dynamically assert that this piece of data conforms to this schema, and will throw an error otherwise"
PhillHenry
@PhillHenry
I thought not. Thanks @SystemFw
Fabio Labella
@SystemFw

:point_up: March 6, 2019 4:26 PM

it's somewhat related to this point

Yosef Fertel
@frosforever
Hey folks, is it possible to prove some A is not a case class? I can do something like evNotCaseClass: A <:!< Product but that’s more broad than I would otherwise want it.
Yosef Fertel
@frosforever
you’ve got much better google fu than me @DmytroMitin!
guess there’s no way using shapeless constructs only?
Dmytro Mitin
@DmytroMitin
@frosforever myabe something will illTyped
Miles Sabin
@milessabin
Hmm ... I thought we did have something like that.
Dmytro Mitin
@DmytroMitin
@frosforever that link at SO shows how to check that T is a case class and negation can be done via standard trick DoesntHave https://stackoverflow.com/questions/24853615/how-in-shapeless-do-you-say-that-a-proof-is-the-empty-type-i-e-false
Yosef Fertel
@frosforever
Ohhh that looks useful too. Gotta play with that a bit. thanks!
Miles Sabin
@milessabin
Why is ruling out Products too broad? Do you want to allow tuples?
Yosef Fertel
@frosforever
In my particular case there’s a class that I want to include that’s not a case class but sadly extends Product otherwise it would be perfect
I think I might just get around it for that particular class with some Low prority implicits instead. That might be easier
Miles Sabin
@milessabin
I think that's probably the simplest approach.
Dirk T.
@DirkToewe
Why does Nat use Peano Arithmetics instead of a binary integer representation?
AndreasKostler
@AndreasKostler

Hi all, is there machinery in shapeless (or elsewhere) allowing you to prove that a particular implicit instance is NOT in scope? I.e.

trait Foo
implicit val foo = new Foo {}

implicitly[Not[Foo]] // Err: "Implicit instance for Foo in scope."

I have something that works but I'm wondering if someone thought about this in more depth before.

Jacob Wang
@jatcwang
@AndreasKostler I'm pretty sure there is. Let me take a look (good to see you again btw! :D)
AndreasKostler
@AndreasKostler
Ahhh thank you! :)
Ethan
@esuntag
I've got a code generator that produces a sealed trait with ~280 case classes extending it. I would like to use Shapeless to do some generic reasoning over this, and am currently working on a parser. However, trying to create a Generic[MyData] leads to a stack overflow. Is there any good way around this?
ritschwumm
@ritschwumm
@esuntag have you tried increasing the VMs stack size to at least -Xss2M ?
Ethan
@esuntag
I'll give that a shot
ritschwumm
@ritschwumm
@esuntag might need even more, i had cases where it required twice as much
Ethan
@esuntag
Thanks. I pumped it up to 4G, that worked. I'll play around a bit more to see where it actually needs to be
It still seems to be having issue with LabelledGeneric, but I can move forward without those for now
Dmitry Avershin
@dmitraver_twitter

hi guys, I have encountered a very interesting issue which I can't really explain but maybe somebody here faced something similar. We use Scanamo in our web application for DynamoDB access. Scanamo uses shapeless internally for conversion between case classes and dynamodb data model. Basically, for this to work there should be implicit formatter in scope for the case class, these formatters are automatically derived via shapeless. I once added a new field to my case class and noticed that tests started blocking infinitely. After hours spent debugging I found out that the place that actually hangs forever is the call to LabelledGeneric.from during the derivation phase but when I tried to evaluate this expression in Intellij debugger it showed me that there is an exception

java.lang.NoSuchMethodError: somepackage.MyCaseClass.<init>(Lscala/Option;Lscala/Option;Ljava/lang/Double;)V

what is interesting here is that this list of parameters doesn't include my new field even though its in code. What is even more interesting is that when I tried to summon the implicit for the formatter on the very high level in my application code like implicitly[DynamoFormat[MyCaseClass]] all code started working again without any blockage and even after I removed this line. When I added new fields again in future I had no problems with it but my colleagues had the same issue. To me it looks like shapeless somehow loads the old (cached somewhere?) version of case class in the situation where code blocks but why then the exception is not thrown? Has anybody seen something similar? Thanks in advance.

Thoren Johne
@thoren
looks like Shapeless is somehow addicted to a clean compile, wish it would be more handsome at that point.