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
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.
ritschwumm
@ritschwumm
hm, can this be related to sbt/zinc#249 ?
elyphas
@elyphas

Hi, i am reading the book "the type astronaut's guide to shapeless" and this has written "types are too specifc", and I have a doubt, "generic" is it the same that "dynamic programming", or what would be the difference?

someone could explain this to me?, please

elyphas
@elyphas
And basically because i understand that type class is better than generic like in "standard template libraries" in c++
elyphas
@elyphas
@DmytroMitin , thank you, :) sorry
samthebest
@samthebest
Trying to automagically create case classes from Map[String, Any]
Dmytro Mitin
@DmytroMitin
@samthebest As I commented in your question at SO, for List you should define one more instance of type class. You can use instance I wrote for Option as an example. If you want this approach to work with any structures like Option, List, nested sealed traits + case classes then probably instances should be defined for arbitrary products/coproducts.
dragonfly.ai
@dragonfly-ai

Could Shapeless help to eliminate the following boiler plate?

Please consider a trait called Navigable. Any class that extends this trait must implement a method that takes a path as a parameter and returns the value at the end of the path. The path encodes steps through the object graph reachable from this object. For example, the path: "foo/8/colors/red" might correspond to this.foo(8).colors.get("red"); that is, a dot access, an array access, then a map retrieval.

We can assume constraints on Navigable objects: 1. They always consist of directed acyclic object graphs. 2. They only reference primitives, maps, arrays, and other Navigable objects.

Can shapeless eliminate the need to write path comprehension code for every single Navigable type?

Fabio Labella
@SystemFw
@dragonfly-ai you should look into lenses, like the Monocle library
dragonfly.ai
@dragonfly-ai

@SystemFw Thanks for the suggestion. I have looked into lenses and the Monocle library. If you write code to declare how they compose with each other, Lenses simulate object mutations by simplifying the process of creating copies of all of the nodes in an object graph.

How does that relate to parsing a path of the form: "foo/8/colors/red" into a series of field, array, and map accesses?

Fabio Labella
@SystemFw
because you can parse that path into an optic (not just lenses, but also traversals and so on)