@plokhotnyuk oh I always though you would have defined your own ADT. I should read a bit more about those libraries; I do not like recommending only circe just because is the one l like, but I barely know what the others do.
Hi need help on calling rest API inside DataFrame to post DataFrame col data and get service response json. The result is single and simple json. I have tried creating udf , df.map both works but the performance is too slow. Please let me know better way to call Rest API inside DataFrame with better performance. Thanks in advance.
Don’t know. Try Scala with Cats at underscore.io and Practical FP in Scala by Gabriel Volpe
D Cameron Mauch
I came across some code with some nested eithers but they nest left and it looks like spaghetti. Is there an easier way? I know I can do for comps right biased. Maybe I should just reverse the parameters.
they could be trying to have "multiple" error types via nested lefts. alternatively they could make an algebraic data type that contains the set of errors they want
That’s what it’s doing, it’s just a mess of left projections and map/flatmaps and indentation that’s hard to follow.
I think IJ support for Scala 3 is not really in the state where debugging is the only remaining frontier :)
That said, I haven't tried debugging in metals yet.. or, for that matter, debugging scala in general.
i recently scala 2 tried in vscode (metals), breakpoints worked but the values on the stack and the controls to pause threads were a bit broken. but, then again, debuggers are not very useful imho. i'm also very impatient and a good ol' println and kill -QUIT <pid> usually tells me what i need to know
I find them very useful when I'm less certain about what the issue might be or when I want to inspect an object I'm unfamiliar with
If there were a good Scala debugger I would definitely use it.
i'm working on a DAP (debug adapter protocol, which VS Code and metals uses) project, and it's quite cool.
Huh. For what?
an apache project that has a fancy data format processor wants a fancy debugger (vs. a janky command-line version)
Eric K Richardson
Where is the project at? What is the difference between this and the normal Java debugger stuff?
it's http://daffodil.apache.org/. you don't necessarily want to debug at the JVM/Java/Scala-level, you want to debug in terms of your higher-level state machine
DAP is just a spec that lets IDEs use a common protocol for different debugger backends
(don't look at the scala code at daffodil. it needs some help.)
The typeclass would provide everything you would need, from that factory method to all the operations on values.
Then users that would like to use your Matrix with their own types only need to provide the instance of the typeclass for that type.
there's an associated type floating around in this concept right? I'm familiar with traits in Rust that have associated types
Luis Miguel Mejía Suárez
Rust traits are typeclasses(or at least equivalent) AFAIK.
Is there any consensus on where your imports should live in Scala files? Like if something is being imported only in the context of a given function, does it make sense to import it there? same with a class or object
It's most common to put them all up at the top.
I like local imports
Eric K Richardson
Local can be an extra constraint where code goes. @tpolecat, I would think you would like.