Discord is now Scala’s main chat platform. Please join us at https://discord.com/invite/scala
@tgeng
given[A[_]](using ev: Applicative[A]): Applicative[[T] =>> Foo[A, T]] with
override def pure[T](t: T): Foo[A, T] = Foo(ev.pure(t))
BTW, I wish I could use map instead of fmap for Functor. But doing that would prevent me from calling the standard map method if I want to provide given instances for, say List. Is there a way to work around this?
WDYM?
Functor
.
F
parameter.
map
map
extension
inside the typeclass definition.
stack trace is suppressed; run last Compile / dependencyBrowseTreeHTML for the full output
A
there will be a new different type B
so in order to properly reference B
you first need an instance of a
I was trying to convince scala 3 to recusrively flatten nested Either
s of some unknown depth but couldn’t figure out how to do it.
I got a match type that describes the expected output type:
case class Inv[T]()
type FlattenR[X] = Inv[X] match
case Inv[Either[ValidationError, x]] => FlattenR[x]
case Inv[x] => Either[ValidationError, x]
but couldn’t figure out a way around erasure to implement it at the value level?
implicit def ordered[A](implicit asComparable: AsComparable[A]): Ordering[A]
ju.Date
extends Comparable[Date]
implicitly[Ordering[Date]].reverse