Live data from Hacker News

I learned Haskell in just 15 years

duckrabbit.tech

91–100 of 240 posts

Re: I learned Haskell in just 15 years

#91
post #81
post #29

Earlier quoted context omitted.

This is sounds like memory safety in C++. https://www.infoworld.com/article/3714401/c-plus-plus-creato...

This seems like a meaningless criticism when it comes to immutability in Clojure. You can have mutability in Haskell too. That doesn’t make it as unsafe as memory management in C++.

> You can have mutability in Haskell too.

Haskell enforces this via a type system.

What safeguards around mutability does Clojure have?

If I import a method 'foo()', is there any kind of contract, notation ... anything which could suggest whether it mutates or not?

Re: I learned Haskell in just 15 years

#92
post #15

Earlier quoted context omitted.

> Clojure emphasizes immutability Is "emphasizes" just another word for second-class support? C++ emphasizes the importance of memory safety.

> Is "emphasizes" just another word for second-class support? I don't know what's your personal definition of "second-class support" but what it means is that it's explicitly supported by the language.

C++ explicitly supports memory-safe programming. You can choose whether you want to mess around with raw pointer arithmetic.

What safeguards does the language actually put in-place?

Re: I learned Haskell in just 15 years

#93
post #87
post #66

Earlier quoted context omitted.

As opposed to the abstract academic world? The only time I had contact with Haskell was in university and I did not see it appealing back then, nor now, nor have I ever seen a program that I use, written in it. So learning a bit of pure Haskell might have been beneficial for me to become a better programmer, but I still fail to see it being more than that - a academic language. Useful for didactic purposes. Less to a…

> nor have I ever seen a program that I use, written in it The only mass market Haskell software that I know of is Pandoc. Others like Shellcheck and Postgrest are popular in their niche. I am not sure that Haskell is faring worse that other programming languages in its level of popularity, like Julia, Clojure or Erlang.

Pandoc seems useful, but maybe "mass market" is a bit of an overstatement?

And since many programmers like myself had to learn Haskell, I think Haskell should have a better head start and be in a better position, if it would be so useful for "real world" use cases.

But please don't take this as an attack on haskell. I have nothing against the language, or its users and I did not suffered because of it in university, I am just curious on the appeal. Because I love clean solutions, but I also want to ship things. So part of me are wondering if I am missing out, but I so far I see not much convincing data. (But I am also mainly interested in high performance and real time graphics and haskell is really not the best here)

Re: I learned Haskell in just 15 years

#94
post #71
post #17

Earlier quoted context omitted.

I've been learning Unison [1] and I highly recommend. It's a Haskell-like language, but with some really interesting ideas around how code should be managed and distributed. They also use use algebraic effects (represented with "abilities" in Unison) instead of Monads, which gives some interesting advantages [2]. [1] https://www.unison-lang.org/ [2] https://www.unison-lang.org/docs/fundamentals/abilities/for-...

Have you written anything in Unison yet? To me Unison feels extremely ahead of its time. They clearly thought things through and aren't afraid to challenge the status quo. Maybe a bit too much ahead of its time even... I fear `ucm` a little. You mean I can't version my things with git? How do I... ehh, do anything? And how is the deployment story if one chooses not to use the Unison cloud?

Can you or someone else familiar with Unison tell us what specific things about Unison feel ahead of its time? I don't know Unison so these things will be a good motivation for me to learn Unison.

Re: I learned Haskell in just 15 years

#95
post #56

Earlier quoted context omitted.

> Is it wrong for me to expect that most programmers are already familiar with functions that only use their inputs They'll experience no friction when using Haskell then. Haskell only refuses to compile when you declare "Oh yeah I know functions from other languages this is easy" but then do some mutation in your implementation.

> They'll experience no friction when using Haskell then. The question was what benefit you'd get from learning a functional language, though. Existing knowledge making it easier to switch to a functional language is the inverse of that. And there's no assumption they'll actually be making things in Haskell, so easy switching isn't by itself a benefit.

Yeah I can't really follow these threads.

I saw:

> What's the benefit of learning a PURE functional programming language, opposed to just using a language which has adapted the best bits and pieces from the functional programming paradigm?

I also saw:

  Though you can break purity with just inputs:

  define f(o): return o.x
  let a = {x=1}
  f(a)
  a.x = 2
  f(a)
I don't know if that's the tail-end of a reductio ad absurdum which is trying to demonstrate the opposite of what it stated. Either way, to be clear, the above would be rejected by Haskell (if declared as a pure function.)

I guess if you learn a functional language "which has adapted the best bits and pieces from the functional programming paradigm" then you might think that the above is broken purity, but if you learn a "PURE functional programming language" then you wouldn't.

Re: I learned Haskell in just 15 years

#97

Earlier quoted context omitted.

Not really, certain problems are just inherently harder to express in a purely functional way than they are in an imperative way (and the reverse is just as true). For example, computing a histogram is much simpler in imperative terms (keep an array of histogram values, go through the original list, add 1 to the array element corresponding to the current element in this list) than in a purely functional style, especi…

> My favorite example of this is implementing quicksort. It's significantly easier in C than it is in Haskell. Oh please, what's so hard about qsort :: Ord a => [a] -> [a] qsort [] = [] qsort (p:xs) = qsort lesser ++ [p] ++ qsort greater where lesser = filter ( = p) xs :) folks, take that with a big ol /s, you would never want to actually use that algorithm. But the real deal isn't all that awful: https://mmhaskell.c…

Well, I'd say using an entirely different collection type than the rest of language (STArray instead of [a]) is already a big complication. It also ends up being more than double the size of the Java code. And, as the author admits, it's actually even slower than the original not-quicksort implementation above, because it actually has to make a copy of the original list, and then return a copy of the mutated array.

So, one of the best sorting algorithms ever devised is not actually usable to sort a [a] in Haskell... I maintain this is a good example of making an easy problem tough.

Re: I learned Haskell in just 15 years

#98
post #93
post #87

Earlier quoted context omitted.

> nor have I ever seen a program that I use, written in it The only mass market Haskell software that I know of is Pandoc. Others like Shellcheck and Postgrest are popular in their niche. I am not sure that Haskell is faring worse that other programming languages in its level of popularity, like Julia, Clojure or Erlang.

Pandoc seems useful, but maybe "mass market" is a bit of an overstatement? And since many programmers like myself had to learn Haskell, I think Haskell should have a better head start and be in a better position, if it would be so useful for "real world" use cases. But please don't take this as an attack on haskell. I have nothing against the language, or its users and I did not suffered because of it in university,…

Pandoc is the standard for markdown conversion. Check out the comments in this recent thread (or pretty much any thread where markdown is mentioned):

https://news.ycombinator.com/item?id=40695628

https://hn.algolia.com/?q=markdown

Re: I learned Haskell in just 15 years

#99
post #38
post #3

Earlier quoted context omitted.

Yes - the value of functional programming isn't that working in OCAML, or F#, or Haskell is 10x as productive as other languages. But that it can teach you worthwhile lessens about designing software that apply equally to imperative languages. Modelling the business domain, reasoning and managing side effects, avoiding common imperative bugs, these are all valuable skills to develop. F# is a great language to learn,…

Hot take of the day: you learn that with imperative programming just as well. I familiarized myself with fp to the point of writing scheme and haskell around 15 years ago. Read the classics, understood advanced typing, lambda calculus and so on. The best “fp” I’m using nowadays is closures, currying in the form of func.bind(this[, first]) and map/filter. Which all are absolutely learnable by the means of closures, wh…

In theory, you could pick up your one language, say, Java, and through the course of a normal career learn everything necessary to program in that language in the best possible way.

In practice, it's a pretty well-known phenomenon experienced by many skilled programmers that being forced into different styles by different languages results in learning things that you would only have learned very slowly if you had stuck only to your original language. To be concrete about the "very slowly", I'm talking time frames of your entire career, if not your entire life and beyond. It would be a long time programming in Java before you discover the concept of something like "pure functions" as a distinct sort of function, a desirable sort of function, and one that you might want organize your programming style around.

Of course, having heard of the concept already, we'd all like to fancy ourselves smart enough to figure it out in less than, say, three decades. But we're just lying to ourselves when we do that. Even the smartest of us is not as smart as all of us. You are not independently capable of rediscovering everything all the various programming communities have discovered over decades. If you want to know what even the smartest of us can do on their own without reference to decades of experience of others, you can look into the state of computer programming in more-or-less the 1980s, 90s if you're feeling generous. I think we've learned a lot since then, and the delta between the modern programmer and a 1980s programmer certainly isn't in their IQ or anything similar, it is in their increased collective community experience.

By getting out into systems that force us to learn different paradigms, and into communities that have learned how to use them, we draw on the experience of others and cover far more ground than we could ever have covered on our own, or in the context of a single language where we can settle into a local optima comfort zone. Jumping out of your original community is kind of an annealing process for our programming skills.

"The best “fp” I’m using nowadays is closures, currying in the form of func.bind(this[, first]) and map/filter."

That is really not the lesson about software design that FP teaches, and blindly carrying those principles into imperative programming is at times a quite negative value, as your experience bears out. FP has more to say about purity of functions, the utility of composition of small parts, the flexibility of composition with small parts, ways to wrap parts of the program that can't be handled that way, and providing an existence proof that despite what an imperative programmer might think it is in fact possible to program this way at a system architecture level. I actually agree 100% that anyone whose takeaway from FP is "we should use map everywhere because they're better than for loops and anyone who uses for loops is a Bad Programmer" missed the forest for the leaves, and I choose that modification of the standard metaphor carefully. I consider my programming style highly influenced by my time in functional programming land and you'd need to do a very careful search to find a "map" in my code. That's not what it's about. I'm not surprised when imperative code is messed up by translating that into it.

Re: I learned Haskell in just 15 years

#100
post #88

In my opinion, if you are after the mystical experience of understanding functional programming, you're better off learning Prolog. I think it has more to offer in terms of insight, because wrapping your head around the language only takes a couple days, but wrapping your head around its consequences is a gift which keeps on giving for quite some time. Immutable functional programming is basically what 80% of your Pr…

Prolog is a logic programming language though, I wouldn't expect it to have a lot of overlap with functional programming?
Post reply on HN