2,029 questions
0 votes
1 answer
56 views
Scala given in lexical scope not found in called function
In Programming in Scala (5th ed), page 462, there is the following code: def isort[T](xs: List[T])(using ord: Ord[T]): List[T] = if xs.isEmpty then Nil else insert(xs.head, isort(xs.tail)) def ...
0 votes
1 answer
69 views
How to specify Scala 3 `scala.Conversion` when the types being converted take an arbitrary type parameter
From the Scala 3 docs on implicit conversions: In Scala 3, an implicit conversion from type S to type T is defined by a given instance of type scala.Conversion[S, T]. For compatibility with Scala 2, ...
0 votes
1 answer
54 views
Implicit Style of TextBlock in DataGrid only applied when declared in App.xaml
I don't understand why an implicit TextBlock-Style is not applied in a DataGrid, unless defined in the App.xaml code. IMO it foiles the rule: the nearer to the possible consumer in the VisualTree, the ...
0 votes
1 answer
42 views
Scala FS2 circe: No implicit found for evidence
I'm trying to realise simple server on FS2, which receives json message and decodes it with circe-library. My code is following: import cats.effect.{IO, IOApp, Temporal} import cats.effect.std.Console ...
1 vote
1 answer
78 views
Given member definitions starting with `with` are no longer supported
Given the following code (pun not intended): trait Display[A]: def display(value: A): String object Display: given stringDisplay: Display[String] with def display(input: String) = input ...
2 votes
1 answer
83 views
Why are `given ... with { ... }` and `given ... = new { ... }` working differently?
Here's an example that makes me scratch my head: // A trait that transforms A -> B trait Transformer[A, B] { def transform(a: A): B } // A trait that creates a Transformer which would encode `...
0 votes
1 answer
61 views
Scala 3 Macro Not able to find given in scope
I am trying to write a macro in Scala 3, which will resolve the types defined in the case class and then find for the given/implict method for those type. below is the code for macro. import scala....
1 vote
0 answers
172 views
xcode16 module 'DarwinFoundation' is needed but has not been provided, and implicit use of module files is disabled
my xcworkspace can build&run success,but when i want to pack my project to a framework,the error occurd: iPhoneOS18.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/...
1 vote
1 answer
154 views
Generic DataPipeline Framework Using Scala3
I have the following design for writing a generic data pipeline using GenericReader[+Out] and GenericWriter[-In] And a Transformer[From, To] which will convert Out => In. These readers and writers ...
2 votes
1 answer
76 views
Can a scala3 macro introduce an implicit value around an existing block?
I am working on a library for use in tests, where I want to be able to have variables that can be redefined in a particular scope. This is inspired by let in rspec. I have something working, by ...
-1 votes
1 answer
72 views
Rails:TypeError in Profiles#show:no implicit conversion of String into Integer
so the problem is that when i create a user profile it takes user input correctly and displays it on view but when I edit it, it goes to the edit page and after click on submit it gives an error ...
1 vote
1 answer
49 views
How to get a normal function from a context function, and viceversa?
If I have a value of type I ?=> O, and I need to pass a value of I => O somewhere else, is there an idiomatic way of achieving that change?
0 votes
1 answer
60 views
regarding scala extension and Givens
Here I have some simple scala program with added extension method to type like string or int, I want to understand what I am missing here so that it works if I can do 1===1 instead of 1.toEqops=...
1 vote
0 answers
82 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
57 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 ...