Questions tagged [contextual-abstractions]

This tag should be used for questions about contextual abstractions, as introduced in Scala 3.

Link to documentation: Contextual Abstractions

4 questions
2
votes
0 answers

Scala 3 contextual abstractions conflict with overloading

Contextual abstractions seem to interfere with overloading, and produce unexpected compilation error messages. This here works: def foo(b: Double ?=> Unit): Double ?=> Unit = () // def foo(a: String): Unit = () // uncommenting causes compilation…
Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
1
vote
0 answers

Value instance is not a member of cats.kernel.Semigroup

I was trying to create a new type class instance of Semigroup in Cats 2.7.0 for a case class called Expense. The problem occurs when the compiler throws an error telling me that the value instance does not exist for cats.kernel.Semigroup. Also,…
0
votes
0 answers

scalafmt - format long chains of infix operators

I have a type declaration somewhat similar to this one: type AwesomeType[F[_], X, Y] = Foo[F] ?=> Bar[F, X] ?=> Baz[F, X] ?=> Waffle[X] ?=> F[Y] when I run scalafmt with align.preset = more, it attempts to squeeze this chain of…
Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
0
votes
1 answer

In scala 3, how to get a given Factory for both something like Iteratable and an Array?

I'm trying to create a trait for sorting functions like this: trait Sorting: def sort[A, B >: A, C <: IterableOnce[A]](list: C)(using ord: Ordering[B], factory: Factory[A, C]): C and here is the implementation: object InsertionSorting extends…
iron9light
  • 1,205
  • 1
  • 13
  • 17