News for hackers. Stuff that matters.
Re:Roc – A fast, friendly, functional language by tromp on Monday November 20, 2023 @10:53AM (#38349704)
Does Roc have any features that a Haskell programmer could consider improvements?
Re:Roc – A fast, friendly, functional language by adjav on Monday November 20, 2023 @11:40AM (#38350239)
Not really, no. Like Elm, it strips away practically everything that wasn't already in 1970s-era ML. It's much closer to a trimmed-down Ocaml than it is to Haskell.
Re:Roc – A fast, friendly, functional language by lambda_garden on Monday November 20, 2023 @12:34PM (#38351191)
Some in the ML community think a simpler language has advantages over a more expressive one, in some cases.

For example: https://github.com/fsharp/fslang-suggestions/issues/243#issu...

Re:Roc – A fast, friendly, functional language by bbkane on Monday November 20, 2023 @05:45PM (#38356008)
Not just the ML community. Go's simplicity is often derided, but I think the best in class tooling (dev tooling like gopls, golangci-lint, deployment tooling like ServiceWeaver, Goreleasor, etc) and easy understandability more than make up for "what yuu can't do"
Re:Roc – A fast, friendly, functional language by tome on Tuesday November 21, 2023 @07:03AM (#38362504)
Not just in the Go community! Everyone believes in "as simple as possible". The disagreement is about "but no simpler".
Re:Roc – A fast, friendly, functional language by tkz1312 on Monday November 20, 2023 @02:06PM (#38352793)
Given its strict purity and use of typeclasses over modules I would say roc is more like haskell than it is ocaml.
Re:Roc – A fast, friendly, functional language by yashrk on Monday November 20, 2023 @11:18AM (#38349976)
First of all — way faster machine code.

Many other things are features or bugs depending of your preferences. For me, for example, eager evaluation is a big improvement, but YMMV.

Re:Roc – A fast, friendly, functional language by satvikpendem on Monday November 20, 2023 @12:12PM (#38350761)
How does it compare to HVM [0]? It is an alternative to GHC that in some cases is orders of magnitudes faster, at least from their benchmarks.

[0] https://github.com/HigherOrderCO/hvm

Re:Roc – A fast, friendly, functional language by weatherlight on Monday November 20, 2023 @12:43PM (#38351343)
i thought the orders of magnitudes faster benchmarks were around lazy evaluation, and probably wouldn't apply here.
Re:Roc – A fast, friendly, functional language by tkz1312 on Monday November 20, 2023 @02:01PM (#38352734)
Roc uses perceus, which is a reference counting model that allows for opportunistic in place mutation if it is safe to do so. HVM is more like a fundamentally new evaluation model that is parallel by default. They are both very exciting, but HVM is much more radical and probably needs at least a few more years until it starts to be seriously practical.
Re:Roc – A fast, friendly, functional language by tromp on Monday November 20, 2023 @11:45AM (#38350313)
> eager evaluation is a big improvement

Does it have any support for laziness? E.g. could one define the list of all fibonacci numbers similarly to Haskell's

    fib = let f a b = a : f b (a+b) in f 0 1
Re:Roc – A fast, friendly, functional language by TwentyPosts on Monday November 20, 2023 @12:04PM (#38350601)
Convenience instead of historical baggage, maybe?
Re:Roc – A fast, friendly, functional language by epgui on Monday November 20, 2023 @12:36PM (#38351220)
All languages have some amount of historical baggage, but I'm not sure what you're referring to here.

If anything, Haskell gets a lot of eyerolls for its slow moving pace and for trying to build a language from mathematical first principles.

It's not perfect (eg.: Monad was not designed to be a special case of Applicative in the beginning, I believe) but it's better at "avoiding baggage" than many other languages I know of.

Re:Roc – A fast, friendly, functional language by tkz1312 on Monday November 20, 2023 @02:03PM (#38352767)
Haskell is a wonderful language, but I don’t think you can claim it’s baggage free. It’s certainly accumulated it’s fair share of technical debt (more in the standard library than the core language to be fair). The endless proliferation of often complex and hard to understand extensions also certainly raises the bar for beginners.
Re:Roc – A fast, friendly, functional language by epgui on Monday November 20, 2023 @05:24PM (#38355766)
> I don’t think you can claim it’s baggage free.

Did I?

Re:Roc – A fast, friendly, functional language by wk_end on Monday November 20, 2023 @01:17PM (#38351959)
Haskell programmers tend to love their monads, but the treatment of effects here ("Tasks"), looks to be - and this is highly subjective - more intuitive and straightforward.

ETA: Also if I'm reading this right Roc appears to natively support some kind of row polymorphism. That's a nice-to-have.

Re:Roc – A fast, friendly, functional language by tkz1312 on Monday November 20, 2023 @01:58PM (#38352686)
I think algebraic effects usually just compile down to monads under the hood? As I understand it, it’s more like a cleaner interface to model side effects, than some new approach compared to the tools that haskell gives you out of the box?
Re:Roc – A fast, friendly, functional language by ReleaseCandidat on Monday November 20, 2023 @02:20PM (#38353014)
No, not necessarily (that's just how some(?) of them are implemented in Haskell, and that's slow too). Since 9.6.1 GHC has primitives for delimited continuations, with which effects should be implementable in a more straightforward and performant way.

Alexis King, who added these primitives to GHC, on (delimited) continuations https://www.youtube.com/watch?v=TE48LsgVlIU

Re:Roc – A fast, friendly, functional language by tkz1312 on Monday November 20, 2023 @02:35PM (#38353289)
I had understood that the delimited continuations stuff was more like performance optimisation for the (slow) free monadic effect systems than a fundamentally different theoretical foundation for modelling effects in a pure language?

fwiw we also have fast effect systems in Haskell these days that are more like fancy type sugar on top of the ReaderT over IO style of things (effectful seems to be the most popular).

Re:Roc – A fast, friendly, functional language by ReleaseCandidat on Monday November 20, 2023 @03:12PM (#38353908)
I've thought that all "native" (in the compiler instead of a library) implementations use (more or less) delimited continuations (some kind of temporary stack moving/copying). OCaml : https://github.com/ocaml-multicore/ocaml-effects-tutorial#3-... And Koka: I haven't found the paper/docs right now.

I know about effectful, but that doesn't use Reader (but provides one) but more or less directly IO (Ref) and "evidence passing", that's why it is faster than the other ones, the drawback is not being able to use non-deterministic effects and noo such thing as coroutines. But I talked about eff ("native" delimited continuations) should be more or less the same, maybe a bit faster, than effectful, but enable non-determinism and coroutines.

Re:Roc – A fast, friendly, functional language by tkz1312 on Monday November 20, 2023 @01:55PM (#38352631)
I think it boils down to:

  - simplicity
  - strict evaluation model
  - devx
  - faster runtime
  - built in effect system
I love haskell and write it every day, but I have the feeling that the language is probably too complex to really cross over to the mainstream. I remain convinced that the advantages of a pure functional approach are so compelling that we will one day see roc or something like it be the default choice for most programming tasks, and am really excited to see so much progress being made on the language.
Re:Roc – A fast, friendly, functional language by zem on Monday November 20, 2023 @03:29PM (#38354203)
strictness!