Live data from Hacker News

Typelevel Scala

github.com

21–30 of 57 posts

Re: Typelevel Scala

#21
post #3

I am not happy about it. Typelevel projects are just porting the style familiar to Haskell programmers to Scala, and a full fork to accomodate this style seems to be an overkill. I know, many people are happy to go full throttle on Cats/Scalaz/whatever, but there's already Haskell for that. Official Scala documentation never even mentions the word "monad" (not even once!), and I think this is a good thing.

This isn't as bad as it looks. Think of it like an additional experimental scalac that is more ready to integrate into mainline scala than Dotty is.

I'm fully on board with you...I think Scalaz as a library is a virus, and it's community is toxic, and it's desperate desire to turn Scala into Haskell ends up turning an awesome ML-inspired language into a vastly inferior religious (...ahem, pure) language.

But Cats and Shapeless aren't Scalaz. They have concepts that happen to exist in Haskell, but they aren't Haskell's concepts to own any more than C owns imperative programming. If anything, Mathematics owns the concepts and Haskell happened to borrow them to make a terrible purist concept slightly more practical. It turns out that when you need the concepts (and I have, on a couple of occasions), it makes Scala slightly more practical as well.

Re: Typelevel Scala

#22
post #18

Well, it's not the first time people try to steer Scala to a different direction. Paul Phillips for instance, after many complaints on the direction the language was going, forked Scala (but now his fork is largely abandoned). https://github.com/paulp/policy

Was he trying to fork the language or the compiler? I thought he wanted a better (by his metrics) compiler for the same language. Did I misunderstand his intent way-back-when this was a thing?

The compiler apparently.

Re: Typelevel Scala

#23
post #8
post #3

I am not happy about it. Typelevel projects are just porting the style familiar to Haskell programmers to Scala, and a full fork to accomodate this style seems to be an overkill. I know, many people are happy to go full throttle on Cats/Scalaz/whatever, but there's already Haskell for that. Official Scala documentation never even mentions the word "monad" (not even once!), and I think this is a good thing.

The Typelevel Scala is nothing more than a branch on which experiments can happen before pull requests are made in the main branch. The people involved have already contributed fixes, like the following by Miles Sabin, which is huge and will make Scala much better: https://github.com/scala/scala/pull/5102 - so basically we've got here a bunch of people that are extremely productive, working for free for the bettermen…

> And really, the strangest things happens when you don't talk about it. You still have for comprehensions, but surprise, they don't behave like in Python, "yield" is again overloaded, having nothing to do with Python's yield or Ruby's yield, and people stumble for no good reason, because it is hard to connect what seems like syntactic sugar over iterators to an expansion using map and flatMap. Along with "computation expressions" from F# or other bullshit naming meant to not scare away the most sensitive of us, the big problem that happens is that people get confused and don't even know what to search for. Search for monads and you'll find endless articles, tutorials, books, research. Search for comprehensions and you get shit.

I agree that Monads deserve our time and attention. Unfortunately, search for monads and you'll get thousands of articles explaining what they are in incomprehensible terminology, along with language-specific type annotations, and devoid of any practical reasons to use them over their non-monadic control flow cousins in imperative languages.

They never seem to explain why you would ever need them, how they help in certain situations. Even worse, they don't tell you when they might actually be hazardous or code smell. They rarely even gloss over the challenges (like needing monad transformers if you want any sort of monadic composition), leaving you to figure that out for yourself when you start bashing your head against the walls.

For all their hard-to-google non-standard terminology, the Scala and F# communities have done a far better job than Haskell at explaining Monads in a way that actually makes people want to learn and use them. And once they have learned the concepts, the elitist sounding language doesn't sound quite so intimidating anymore.

Re: Typelevel Scala

#24
post #3

I am not happy about it. Typelevel projects are just porting the style familiar to Haskell programmers to Scala, and a full fork to accomodate this style seems to be an overkill. I know, many people are happy to go full throttle on Cats/Scalaz/whatever, but there's already Haskell for that. Official Scala documentation never even mentions the word "monad" (not even once!), and I think this is a good thing.

This isn't as bad as it looks. Think of it like an additional experimental scalac that is more ready to integrate into mainline scala than Dotty is. I'm fully on board with you...I think Scalaz as a library is a virus, and it's community is toxic, and it's desperate desire to turn Scala into Haskell ends up turning an awesome ML-inspired language into a vastly inferior religious (...ahem, pure ) language. But Cats an…

You happen to think the most popular scala library is a virus?

We use it extensively at Verizon, and it exists just fine with 'impure' code, Akka code, or whatever else various teams decide to also pull in. Codebases that don't use Scalaz end up re-inventing it, usually in a more buggy way and at a waste of developer effort.

Reinventing is fine on your own for a learning exercise and I certainly did it a few times, but in production code, just use Scalaz. Or sure, I suppose if you want to use a copy and pasted into a new repo version of Scalaz, go for Cats. I don't even know why Shapeless is brought into the conversation, it has a much more narrow use case and I almost never reach for it.

I've also found the Scalaz community and chat room on IRC quite helpful, whereas I've had some really unpleasant interactions with Cats committers. To go around spreading FUD and promoting an alpha level library that's less than half as popular as Scalaz (according to Github stars) is just irresponsible.

Re: Typelevel Scala

#25
post #3

I am not happy about it. Typelevel projects are just porting the style familiar to Haskell programmers to Scala, and a full fork to accomodate this style seems to be an overkill. I know, many people are happy to go full throttle on Cats/Scalaz/whatever, but there's already Haskell for that. Official Scala documentation never even mentions the word "monad" (not even once!), and I think this is a good thing.

This isn't as bad as it looks. Think of it like an additional experimental scalac that is more ready to integrate into mainline scala than Dotty is. I'm fully on board with you...I think Scalaz as a library is a virus, and it's community is toxic, and it's desperate desire to turn Scala into Haskell ends up turning an awesome ML-inspired language into a vastly inferior religious (...ahem, pure ) language. But Cats an…

The overlap between cats and scalaz is gigantic idk why you seem to think they are distinct? I'd bet that the overlap between the most commonly used parts of cats and scalaz is even larger.

The main thing scalaz has that cats doesn't is scalaz.concurrent.Task, and there are multiple typelevel-endorsed alternatives to it being worked on as well (in monix and fs2). Task is wonderful btw.

fwiw we use scalaz at work and haven't upgraded to cats because it isn't ready. cats just fixed a performance bug that would have destroyed us (Map union mappend was ridiculously unoptimized compared to scalaz's). We .foldMap(/* make a small Map*/) all the time and it's one of our favorite parts of scalaz. see https://github.com/typelevel/cats/issues/1290 for the bug.

Re: Typelevel Scala

#26
post #10

Earlier quoted context omitted.

Well one of the confusions I think early on (or at least professed confusion on Lambda the Ultimate IIRC) is that Scala is mixed paradigm and that adds additional load for learning. Some feel it should go full FP (what I mean by that is really discourage OOP, side effects, etc...). There is some valid arguments as Rust and Haskell might end up being an easier language to master as you can completely avoid the OOP con…

OOP hate is common these days, but I always has been an OOP enthusiast. I used to write in Smalltalk, I implemented a few metaobject protocols of my own, and I think OOP had deserves its success (unfortunately, C++/Java is not really OOP... However, some principles still apply). So, when a language appeared to combine the best ideas from FP and OOP, I happily embraced it. And I want it to stay this way.

Sometimes you really need to drop into mutation of state in perf critical paths

Re: Typelevel Scala

#27
post #24

Earlier quoted context omitted.

This isn't as bad as it looks. Think of it like an additional experimental scalac that is more ready to integrate into mainline scala than Dotty is. I'm fully on board with you...I think Scalaz as a library is a virus, and it's community is toxic, and it's desperate desire to turn Scala into Haskell ends up turning an awesome ML-inspired language into a vastly inferior religious (...ahem, pure ) language. But Cats an…

You happen to think the most popular scala library is a virus? We use it extensively at Verizon, and it exists just fine with 'impure' code, Akka code, or whatever else various teams decide to also pull in. Codebases that don't use Scalaz end up re-inventing it, usually in a more buggy way and at a waste of developer effort. Reinventing is fine on your own for a learning exercise and I certainly did it a few times, b…

Exactly. Practically every interesting scala lib (from scalatest to play to sbt) has internal implementation of functional patterns.

Re: Typelevel Scala

#28
post #8

Earlier quoted context omitted.

The Typelevel Scala is nothing more than a branch on which experiments can happen before pull requests are made in the main branch. The people involved have already contributed fixes, like the following by Miles Sabin, which is huge and will make Scala much better: https://github.com/scala/scala/pull/5102 - so basically we've got here a bunch of people that are extremely productive, working for free for the bettermen…

I am not afraid of big words, I did some research on implicit parallelization with arrows. :) But Scala is a hybrid pragmatic functional language, not aspiring to some advanced type research (except in FP-OOP interop). Even typeclasses, while working, are somewhat a hack in Scala. Why not use more appropriate languages for research and leave Scala to be good where it excels?

Scala has first-class syntactic support typeclass-constrained generics (see context bounds) so idt they are a hack at all. Lack of canonicity and runtime representation are the main differences between Haskell and Scala typeclasses.

Re: Typelevel Scala

#29
post #8

Earlier quoted context omitted.

The Typelevel Scala is nothing more than a branch on which experiments can happen before pull requests are made in the main branch. The people involved have already contributed fixes, like the following by Miles Sabin, which is huge and will make Scala much better: https://github.com/scala/scala/pull/5102 - so basically we've got here a bunch of people that are extremely productive, working for free for the bettermen…

> And really, the strangest things happens when you don't talk about it. You still have for comprehensions, but surprise, they don't behave like in Python, "yield" is again overloaded, having nothing to do with Python's yield or Ruby's yield, and people stumble for no good reason, because it is hard to connect what seems like syntactic sugar over iterators to an expansion using map and flatMap. Along with "computatio…

> done a far better job than Haskell at explaining Monads [..] the elitist sounding language

For fucks sakes, nobody invents words like "monad" to sound elitist.

Re: Typelevel Scala

#30
post #24

Earlier quoted context omitted.

This isn't as bad as it looks. Think of it like an additional experimental scalac that is more ready to integrate into mainline scala than Dotty is. I'm fully on board with you...I think Scalaz as a library is a virus, and it's community is toxic, and it's desperate desire to turn Scala into Haskell ends up turning an awesome ML-inspired language into a vastly inferior religious (...ahem, pure ) language. But Cats an…

You happen to think the most popular scala library is a virus? We use it extensively at Verizon, and it exists just fine with 'impure' code, Akka code, or whatever else various teams decide to also pull in. Codebases that don't use Scalaz end up re-inventing it, usually in a more buggy way and at a waste of developer effort. Reinventing is fine on your own for a learning exercise and I certainly did it a few times, b…

Sorry, but there's no way scalaz is a more popular library than Spark.
Post reply on HN