1. 9
  1. 9

    When submitting Reddit links, consider changing the www in www.reddit.com to old. Makes the site load in one go, instead of having to re-load parts of the comment section over and over again.

    1. 6

      Many of the aforementioned features surely suck, but there is no such thing as the correctness of a feature[1]. I have the feeling that these people consider these features “incorrect” because they are not implemented the Haskell way.

      1: I mean, what’s wrong with the fact that Guido decided that sum won’t work with strings? Nothing. This is a choice. It is valid because it doesn’t conflict with existing Python specs. We could also decide that sum returns 123 if called with a File object. This is another (terrible) choice that isn’t wrong either.

      PS: Well, in the world of formal specs we can surely talk about the correctness of a feature, but I don’t think that “incorrect” in the title of this page has this meaning. I guess it means something like “not Haskell-friendly”.

      1. 4

        What’s wrong with sum() not working with strings? Well, the fact that "foo" + "bar" does work and returns "foobar" as one could expect. The fact that str type has a __add__() magic method and that’s supposed to be the standard protocol for “addition” (whatever it is).

        Another example from Python is True + 2 = 3. This result is useless, and it misses a chance to catch situations that are almost surely programming errors. It does make "foo" + 2" type error instead of arbitrarily deciding a numeric value of "foo" or (more justifiably) returning "foo2".

        Overall, Python has an incredibly consistent and logical design, but these behaviours violate the conventions it follows nearly everywhere else in its design, and that’s not a good thing.

        1. 2

          Out of curiosity, how would one concatenate a list of strings in Python?

          1. 2

            "".join(["foo", "bar", "baz"]). Sometimes, OO approach just makes little sense.

            1. 1

              It’s nicer ergonomics when you want to concat with a non-empty separator. Which, in my experience, is a very common thing to want. But, you can have it your way if you like:

              import functools as ft; ft.reduce(lambda l, r: l+r, ['foo', 'bar', 'baz'])

              Still, it would be nice if sum were implemented with __add__.

              1. 2

                Oh, I’m not denying usefulness of that join API. I just find it funny that it’s presented as a method of the separator string. It also makes it somewhat harder to discover.

                It could be simply a function of a separator and a string list:

                # String.concat ", " ["foo"; "bar"; "baz"] ;;
                - : string = "foo, bar, baz"
                
        2. 1

          Though some have been brought up in a world of “fair and balanced” and “all sides are equal”, I think in more than 80% of the cases it’s possible to determine which version of a feature is correct without too much effort.

          1. 2

            This sort of snide dismissal is how we get Javascript in 2020. Make Ecmascript Great Again.

            You shouldn’t be so quick to dismiss the habits of languages and programmers you find deplorable.

        3. 9

          Do you have any examples of libraries in other languages or language features, which really should have implemented a well-known concept (Monoid, Monad, Alternative, whatever), but they fell short because they (probably) didn’t know the concept?

          This sort of presumptive arrogance is a massive turnoff for me, and I think that it really hampers my ability to take Haskell users or their community seriously.

          This whole “well-known” idea is glib coming from the community whose running joke is just a monoid in the category of endofunctors–i.e., famously academic and up its own ass.

          A better way (hell, we could start it in this subthread) they could’ve brought this up would’ve been “What Haskell idioms (Maybe, monads, etc.) do other ecosystems implement almost like we would but then diverged? What idioms do we have that’d still be doable in those ecosystems?”

          Instead, it comes off as some ignorant elitist prick dismissing the slovenly masses daring to attempt to fumble their way through shipping code in spite of their own ignorance of the magic of Haskell, somehow managing to cobble together pale imitations of algorithms and techniques in their inferior programming tongues.

          Pandoc and shellcheck are maybe the only Haskell programs I use on a regular basis, but I could get along without them. I couldn’t get along without the flotsam and jetsam of “inferior” languages like C and JS, and I’m kinda amazed that in 2020 people still represent Haskell like this.

          EDIT: Just to be clear, I know some Haskell folks (@pushcx, @shapr) that are kind and just excited and happy to share their experience without shitting on other languages I use…but they seem to be in the minority.

          It’s the difference between “Haskell is the one true language why are you settling for anything else?” versus “I really like Haskell and think it’d be a good fit for your problem, want to talk more about it? If not that’s cool my dude, one day I’ll talk you into it. :)”

          1. 10

            I totally understand. Do give that community some benefit of doubt though, as this is a link to a thread within the haskell subreddit where the posters feel free to write without having to preface every post/comment with qualifiers as it might get a little tedious if they had to do that on every thread and comment. If we’re not part of that subreddit, in a way, we are peeking in as an outsider and before judging them harshly, we’ll have to read it with their perspective in mind. Hope I’m making sense. I was almost not gonna post here because of the potential for misunderstanding their tone but it was just a really interesting topic and I was wondering if I could get more viewpoints over here. Although now I’m not sure if it was worth it.

            1. 3

              Thank you for the caution towards charity and reasonableness!

            2. 6

              I like being called out for kindness and excitement.

            3. 3

              Not so much about Haskell as about why unimaginative mainstream languages suck.