All Questions
1,525
questions
1
vote
0
answers
54
views
Can I disable default Marker Context (NoMarker) passed implicitly when using play.api.Logger and require a different MarkerContext is always provided?
I am trying to add a unique request id to logs for each request that is made to a rest api. For that I want to pass implicitly a MarkerContext to each logger method called. Currently the NoMarker ...
0
votes
1
answer
45
views
scala how to declare a type define which must have implicit conversion?
I need call a function def fromJsonString[Result <: B : C](jsonString: String): Result = ???.
And I define a trait MyContext in order to matching a various instance of type Result.
MyContext define ...
2
votes
1
answer
161
views
givens / implicits for Scala 3 Union Types
I have some typeclass, e.g.:
trait ExampleTypeClass[A]
// imagine one or more methods here
object ExampleTypeClass:
given ExampleTypeClass[Int] = new ExampleTypeClass{/* ... */}
given ...
1
vote
2
answers
162
views
Can't execute an extension method of a context function in Scala 3
I defined an extension method on a context function in Scala 3:
object Scope {
extension [E, A](a: List[E] ?=> A) def extFoo: A = foo(a)
private def foo[E, A](a: List[E] ?=> A) = {
...
3
votes
1
answer
80
views
Can't create an anonymous implementation of ContextFunction1 in Scala 3
I'm trying to create an anonymous implementation of a context function in Scala 3. In detail, the code is the following:
def mem[E, A](block: Raise[E] ?=> A): Raise[E] ?=> A = new ...
0
votes
1
answer
46
views
how to call a class inside another Scala Object?
I have a class DFHelper which helps getting the dataframe keys.
I want to maintain it as generic code and call it from another main scala object. E.g the first code section i am defining for generic ...
0
votes
1
answer
119
views
ZIO Quill: Can't find implicit SchemaMeta for type models.Pet
I'm currently working on a pet store application using ZIO and Quill. As part of my learning process, I've set up a local H2 database and configured it to store pet information. However, I'm ...
2
votes
2
answers
79
views
How to define a "fallback" implicit?
Consider a tapir.Codec object (this is how I encountered this problem, but I don't think it has much to do with tapir specifically, it is just about implicit resolution priority in general), it has a ...
0
votes
1
answer
88
views
In Scala 2/3, why can't unboxing or view bounds be chained (as in OCaml), and how to fix/circumvent it?
Considering the following example, derived from the official manual of Scala 3 on Context Abstractions:
https://docs.scala-lang.org/scala3/guides/migration/incompat-contextual-abstractions.html#view-...
2
votes
1
answer
114
views
How to test fastparse parsers in a separate class?
I'm writing a parser, something like,
object MyParser:
def int[$: P]: P[Int] = digit.rep(1).!.map(s => s.toInt)
def digit[$: P]: P[Unit] = CharIn("0-9")
Now I'd like to test this in ...
0
votes
0
answers
78
views
Scanamo Paginated Query Issues
Need example of a method to create paginated query on dynamoDb using scala's, Scanamo library
I am trying to create to create a method which performs paginated queries on dynamodb table using a query ...
0
votes
0
answers
62
views
All partial unification algorithms failed on implicit conversion from functions - How to improve in Scala?
Here is a simple example:
object UnificationOnConversionFromFn {
trait :=>[I, R]
implicit def fromVanilla[I, R](
vanilla: I => R
): I :=> R = ??? // fail
implicit def ...
1
vote
1
answer
97
views
Implicit resolution failure when multiple instances present, despite having different types
My goal is to implement a Schema[T] (from scala-jsonschema) and Writes[T] (from play-json) for a handful of T classes whose companions I can't modify. My sub-goal is to define them close together to ...
2
votes
0
answers
40
views
Extensions methods using implicits do not compile with Scala 3
Following code compiles fine with Scala 2.13.12, but not with Scala 3.3.1:
import scala.language.implicitConversions
object Types {
trait Vector3f
implicit class Vector3fOps(v: Vector3f) {
...
2
votes
0
answers
54
views
Scala 3 given/implicit resolution doesn't work as expected
I'm working on the Chapter 11 Case Study: CRDTs from the excellent book "Scala with Cats". The code in the book is written using Scala 2, but I've modified it for Scala 3, specifically 3.3.1....