Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 18 19:35
    @SethTisue banned @lunaterra22
  • Sep 14 18:08
    @SethTisue banned @discjock:matrix.org
  • Sep 12 20:37
    @SethTisue banned @manuelzamoratetherbtcusa:matrix.org
  • Sep 06 14:29
    @SethTisue banned @white_hat_hacker:minds.com
  • Sep 06 14:29
    @SethTisue banned @alexchole:matrix.org
  • Aug 31 17:03
    @SethTisue banned @andersonwatts7:matrix.org
  • Jul 19 20:37
    @SethTisue banned @tonyobanon
  • Jan 02 23:58
    @SethTisue banned @fakubishes:nerdsin.space
  • Dec 15 2021 05:01
    som-snytt commented #12516
  • Dec 15 2021 04:38
    SethTisue edited #1312
  • Dec 15 2021 04:38
    SethTisue opened #2273
  • Dec 15 2021 04:31
    jackkoenig opened #12516
  • Dec 15 2021 04:29
    SethTisue edited #1312
  • Dec 15 2021 04:28
    SethTisue edited #1312
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    scala-jenkins milestoned #9831
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    SethTisue opened #9831
  • Dec 15 2021 03:35
    som-snytt commented #11339
  • Dec 15 2021 03:27
    som-snytt labeled #12494
Hanns Holger Rutz
@Sciss
@BalmungSan thanks, excellent
Luis Miguel Mejía Suárez
@BalmungSan
Did that worked?
Hanns Holger Rutz
@Sciss
yes
Hanns Holger Rutz
@Sciss
errrr, @unused doesn't cross compile in Scala 2.12. But it's part of scala-collection-compat.
Luis Miguel Mejía Suárez
@BalmungSan
:sweat_smile:
Mark T. Kennedy
@mtk
anyone else having problems reaching docs.scala-lang.org? it's mapped to icvm0053.epfl.ch (128.178.218.78) and traceroute dies at the first epfl.ch host it reaches.
Luis Miguel Mejía Suárez
@BalmungSan
Mark T. Kennedy
@mtk
thanks!
go through with this and make it runnable
johannes karoff
@cornerman
To answer my own question about finding out which member method are abstract (not implemented) in a macro, you can use: TypeTree.of[T].memberMethods.filter(_.flags.is(Flags.Deferred))
Edrick de Guzman
@edrick.deguzman_gitlab
Hello everyone, I would like to ask for some guidance/insight regarding create a jar file/package for my scala test project? I currently don't have a main class since we use test instead of main. Can anyone point me to the right direction?
Luis Miguel Mejía Suárez
@BalmungSan
@edrick.deguzman_gitlab care to elaborate?
Why do you want to create a jar if you don't have a main?
Who is going to be your user?
tgeng
@tgeng

I have a naive question about using type class in scala 3. So I defined a Functor and an Applicative trait in the standard way

trait Functor[F[_]]:
  extension[T] (f: F[T])
    def fmap[S](g: T => S): F[S]

trait Applicative[A[_]] extends Functor[A] :
  def pure[S](s: S): A[S]

  extension[T] (a: A[T])
    infix def <*>[S](f: A[T => S]): A[S]

Then I am trying to add given instance that needs some other applicative:

given[A[_]: Applicative]: Applicative[[T] =>> Foo[A, T]] with
  override def pure[T](t: T): Foo[A, T] = Foo(pure(t))
  // ... rest omitted

where Foo accepts a A[T]. But the above code resolves pure(t) to the pure being defined, rather than the pure available from A[_]: Applicative. How can I provide a hint so resolution goes to the right function?

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?

Luis Miguel Mejía Suárez
@BalmungSan

@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?

2 replies
Luis Miguel Mejía Suárez
@BalmungSan
@tgeng please don't use threads.
Second, that is not a valid Functor.
At least not one represented using typeclasses.
You need the F parameter.
Ah well no.
Forget about it.
I am not used to extension methods.
tgeng
@tgeng
Thanks @BalmungSan ! I am not sure I follow. Anyway. Let me explain my second question.
Luis Miguel Mejía Suárez
@BalmungSan
No no
You are right.
I am just rusty with Scala 3.
I guess the extension makes it impossible to use the stdlib map
That is probably a bug.
No idea.
tgeng
@tgeng
Right, that's my second question.
Luis Miguel Mejía Suárez
@BalmungSan
Still I don't think people will use inner extensions.
For multiple reasons.
I guess most people will keep using the Scala 2 pattern of having the typeclass and the extensions defined separately.
tgeng
@tgeng
OK, so you mean define fmap just as a non-extension function and then define an extension map calling fmap?
Luis Miguel Mejía Suárez
@BalmungSan
Yup.
Or even just map
(sorry for the late response)
just like cats does as today.
tgeng
@tgeng
Got it! Makes sense! Thank you very much!!
Luis Miguel Mejía Suárez
@BalmungSan
But again, it may be just me not using Scala 3 a lot yet.
Is just that for a couple of things I have seen, that I think that most people will NOT use extension inside the typeclass definition.
tgeng
@tgeng
TBH, I have basically 0 experience with scala 2 so now that I kind of get that extension is a new thing that may not interact well with other language features.
Again, thank you for helping me!
rohith
@rohithbittu33_twitter
hi all, I am getting below error when I am running sbt dependencyBrowseTree. I made sure I am using sbt version=1.5.6 and also added enablePlugins(MiniDependencyTreePlugin) in my build.sbt. Can someone help me to solve this error?
stack trace is suppressed; run last Compile / dependencyBrowseTreeHTML for the full output
ritschwumm
@ritschwumm
@rohithbittu33_twitter what does last Compile / dependencyBrowseTreeHTML say? anything interesting in the stack trace?
Clinton Mead
@clintonmead
What do I need the type of x to be in the following code to be able to refer to x.f in g()? A.B didn't work.
trait A {
    trait B {
        def f: Unit
    }
}

object O {
    def g(x : ?): Unit {
        x.f
    }
}
nova
@nova99:matrix.org
[m]
A#B?
lambook
@lambook
Hello there, i want to write a method to concatenate many Byte arrays
def join(parts : Array[Byte]* ) : Array[Byte] ={...
is there already something to do that in scala ? thnx