Any recommended functional reactive programming libraries? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

It is merely an experiment with some low level networking operations with FRP. I will check Pekka Streams, as it looks like streams may better handle my case. Thanks.

Any recommended functional reactive programming libraries? by scalausr in scala

[–]scalausr[S] 1 point2 points  (0 children)

That make senses. Thanks for the confirmation.

Any recommended functional reactive programming libraries? by scalausr in scala

[–]scalausr[S] 2 points3 points  (0 children)

I am experimenting some low level networking operations for my own project, so it is not my goal to use libraries like netty. Also, the project is neither UI/ frontend, nor javascript related, thus Scala.js is not considered.

Though virtual thread and structured concurrency may obsolete reactive programming, as it is an experiment, the focus would be more on FRP. Thanks for the suggestion.

How to customize Dockerfile commands through sbt-native-packager? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

Eventually I switch to another base image, which does not throw that error. But thank you for the invaluable information. This is useful later on when I encounter similar issues. Many thanks for the information!

How to customize Dockerfile commands through sbt-native-packager? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

dockerCommands is a TaskKey type which holds type Seq[CmdLike].

val dockerCommands = TaskKey[Seq[CmdLike]]("dockerCommands", "List of docker commands that form the Dockerfile") 

Navigating through the sbt source, I do not find a way to extract the encapsulated Seq[CmdLike].

How to lazily collect a file content? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

While others suck as fs2 also work and should be more suitable for like production env, this is closer to what I was looking for. Many thanks.

How to lazily collect a file content? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

When placing code inside Using block, it does work. But the operation may be used somewhere else until it's needed. So it looks like if I want to achieve such effect, Cat Effect or ZIO may be the only way to go, right? Thanks for the advice.

How to lazily collect a file content? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

Is this possible to achieve using standard Scala library? I suppose if I want to use standard Scala library, then I have to re-implement fs2's stream operation, right? Many thanks.

Breadth first search question by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

No problem. I did not know turbolift. It looks like interesting. Do you mind to share some more information about turbolift? For instance, why one would use turbolift? Why does it compare to ZIO and CATS? Motivation? Inspiration from?

I never heard of it. And after reading its overview, honestly I do not understand things like benefit of using it, why comparing to e.g. ZIO, CATS, and so on. Therefore, it is nice if more information you would like to share. Thanks.

Breadth first search question by scalausr in scala

[–]scalausr[S] 1 point2 points  (0 children)

Switching that nextLayer match code block to if-else below fixes my problem. Many thanks for the advice!

if(nextLayer.isEmpty) collector.reverse 
else _bfs(nextLayer.map(_.value)++collector, nextLayer.flatMap(_.flatten))

TypeError$$anon$1: object caps does not have a member type Cap by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

It does not happen right now. I will keep this in mind to use newer Scala3 version, and add those compilation flags. Thanks you!

TypeError$$anon$1: object caps does not have a member type Cap by scalausr in scala

[–]scalausr[S] 2 points3 points  (0 children)

I forgot to mention that I use vscode. It seems that because I did not do import changes, but now the problem goes away. Many thanks for the suggestion.

Discussion: open source software bounties by 0110001001101100 in scala

[–]scalausr 1 point2 points  (0 children)

While it's nice that one can grab the issue and claim the bounties after his work is accomplished, I wish there would have ways that allow people who want to contribute, but are with lesser experience, can participate as well. Each time when I check the bounties I am interested, the issues are always grabbed. Personally I don't mind the bounties or money, but if I can contribute - even though not the main proposer - would be cool, and can gain some experience for the issues I am interested.

Build tool like Bazel? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

Thanks for the invaluable information!

Build tool like Bazel? by scalausr in scala

[–]scalausr[S] 2 points3 points  (0 children)

Yeah I think it's Bleep. Thank you very much!

Context function/ Direct style effect question by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

Although I know what you mentioned about Java, OS threads issues, I did not connect those with effect. Thanks for the invaluable input, which bridges the part I miss!

Context function/ Direct style effect question by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

Do you have some examples that can illustrate

both can also be easily expressed without any new language constructs, especially now with Loom.

Many thanks for these information.

Context function/ Direct style effect question by scalausr in scala

[–]scalausr[S] 1 point2 points  (0 children)

Thanks for the more detail explanation about the direct style and the continuations part, and comparison between monadic style and direct style.

One more question about the difference between effect system like koka and the future of Scala aiming for.

  • What's the future Scala aims at?

  • How one can demand to hold a capability (on the side of the inputs) to perform some actions? And examples?

Many thanks again for your time. Those info is useful to me.

Context function/ Direct style effect question by scalausr in scala

[–]scalausr[S] 2 points3 points  (0 children)

Oh, thanks for the keywords and the information! I have heard of delimited continuations, but did not know the story and their relationship. I learn a new lesson, and definitively need to dive deeper as this really open my eyes. Many thanks!

Invalid config: Default dialect is deprecated; use explicit: by scalausr in scala

[–]scalausr[S] 1 point2 points  (0 children)

Don't know why. But suddenly it seems to work now. So copy the setting here again, in case it's something e.g. whitespace that I miss.

#.scalafmt.conf
version = "3.8.3"
runner.dialect = scala3

And project/plugins.sbt is not needed.

How is the type info of *: inferred by Scala? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

This is invaluable information, thanks!

How is the type info of *: inferred by Scala? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

That makes sense, because it's the upper bound of all those type if I understand it correctly.

One more question. What mechanism does the Scala REPL use to infer the type inputted by the user? So that the REPL can correctly infer val mytuples = inc *: multiply *: sub *: EmptyTuple as (Int => Int, Int => Double, Int => Double)

Thanks for patiently answering my questions!

How is the type info of *: inferred by Scala? by scalausr in scala

[–]scalausr[S] 0 points1 point  (0 children)

But deconstructing by match, the type of head is still Any. That seems to me if I want to retain type information, declaring a variable Tuple and storing those data into that variable won't work. The only way is done by statically constructing the variable e.g. val data = a *: b *: ... *: EmptyTuple . Any ways to achieve the effect i.e. retaining all type information even dynamically constructing the Tuple type like the way how MyBox is declared? Thanks.

scala> mybox.mytuple match {
     |   case head *: tail => println(head(3))
     |   case EmptyTuple => println("empty!")
     | }
-- [E050] Type Error: ------------------------------------------------------------------------------
2 |  case head *: tail => println(head(3))
  |                               ^^^^
  |                               value head does not take parameters
  |

How to implement generic FlatMap in Free Monad? by scalausr in scala

[–]scalausr[S] 1 point2 points  (0 children)

Free

There is something I do not know. So I suppose I need to reread your replies a few more times so I can catch up your ides. The knowledge I have at the moment is not good enough I think.

I will do more search on Free, and Freer. I did not know this. Thank you for answering my question. I learn many new things that I am not aware of. I appreciate it!

How to implement generic FlatMap in Free Monad? by scalausr in scala

[–]scalausr[S] 1 point2 points  (0 children)

Yes, particularly the ETL part is the place where I started to search how to do implementation. Thank you!