Most active commenters
  • tasuki(4)

←back to thread

193 points ingve | 24 comments | | HN request time: 0.528s | source | bottom
1. mikojan ◴[] No.43712753[source]
In another life I will be a Haskell programmer
replies(6): >>43712991 #>>43713006 #>>43713074 #>>43714014 #>>43714156 #>>43716535 #
2. Avicebron ◴[] No.43712991[source]
Yeah me too, I'll invest in bitcoin early, live like a hermit off a coast somewhere, and school kids on HN, "cabal hell! I'll scream, no, Conda hell with powershell hooks in vscode you ingrates, my llm"
3. revskill ◴[] No.43713006[source]
Why not python ?
replies(3): >>43713045 #>>43713108 #>>43714465 #
4. linguae ◴[] No.43713045[source]
I’m not the OP, but static types, Hindley-Milner type inference, algebraic data types, and pattern matching can be quite ergonomic. I have also come to appreciate functional programming and how it makes reasoning about and testing code easier.
replies(2): >>43713201 #>>43713342 #
5. whateveracct ◴[] No.43713074[source]
It's a lot of fun!
6. xboxnolifes ◴[] No.43713108[source]
They really aren't anything alike at all.
7. kqr ◴[] No.43713342{3}[source]
Yeah, just last week I updated the numeric precision of a value across an entire user journey in a big enterprise application, spanning many functions and data types. Thanks to Haskell, I could do it in a day.

In any other language I've used (barring maybe Ada) that is a refactoring that would take at least days, if not weeks, to manually track down all the places it interacts with the system directly or indirectly, because mixing e.g. int with long long is not a type error.

In Haskell, I change the type and the compiler spits out a list of locations that needs to change. This is repeated for a few iterations until all transitive interactions are worked out. Done!

8. runeks ◴[] No.43714014[source]
I fear that in another life I will be a JavaScript programmer
9. kreetx ◴[] No.43714156[source]
Choose this life instead!
10. tasuki ◴[] No.43714465[source]
No one wants to be a python programmer. It's a practical language to get things done. It isn't a language to make you feel proud of yourself nor about the current state of our industry.
replies(3): >>43715762 #>>43716452 #>>43724201 #
11. Philpax ◴[] No.43715762{3}[source]
The concept of "the Pythonic Way" indicates to me that there are people who are proud of being Python programmers.

May God have mercy on their souls.

replies(1): >>43724409 #
12. sgarland ◴[] No.43716452{3}[source]
I’ve enjoyed making it go faster by finding quirks, but at this point it’s mostly become “OK, what else can I offload to C?”

I should really learn Rust. Or Zig. I tried Nim (best of both worlds, Python-esque code that compiles to C!), but it wasn’t nearly as fast as my Python + C for my specific use case.

replies(1): >>43719330 #
13. cosmic_quanta ◴[] No.43716535[source]
There's no time like the present. Feel free to reach out if I can help you along your journey
replies(1): >>43720364 #
14. knighthack ◴[] No.43719330{4}[source]
What exactly do you write, where your Python+C is faster than Nim which compiles to optimized C?
replies(1): >>43719502 #
15. sgarland ◴[] No.43719502{5}[source]
Generating millions of rows of synthetic data for testing RDBMS.

Tbf, I didn't spend much time trying to optimize the Nim code once I got a working PoC, so it's entirely possible that I could've made it faster.

replies(1): >>43721105 #
16. tasuki ◴[] No.43720364[source]
Not the person you're replying to, but I'll bite:

I've written low thousands of lines of Haskell. Similar to mikojan, I love Haskell in theory, but ended up not enjoying it as much in practice.

1. The multitude of string-y types. I end up converting between String, Text, Lazy Text, ByteString, Lazy ByteString, and I forget what else. Each library wants me to pass in a specific string type, and each other library returns a different string type. LLMs are good at this, also for a while I had a ton of helper functions to convert between any two string types. Still, perhaps there's a better way?

2. The error messages. I come from Elm, so I'm spoiled. Yes, I understand a language with HKTs will never have as nice error messages. Yes, LLMs are pretty good at explaining GHC error messages.

3. The stdlib. Haskell gets a lot of credit for safety, but a `head` blows up instead of returning a `Maybe`. I know there are other - safer - preludes, but I don't know how to choose between them. I don't know how using a different prelude would impact my projects.

I feel like my next step is either towards Idris, with its polished standard library (and dependent types baked into the language!), or towards something simpler and more Elm-like (Gleam perhaps, or Roc). But if you can sell me on Haskell, I'm all ears!

replies(3): >>43721245 #>>43724195 #>>43734571 #
17. cb321 ◴[] No.43721105{6}[source]
You may no longer be interested in this kind of thing, but if you are there might be some ideas of note over at https://github.com/c-blake/nio/blob/main/db-bench.md (in particular the demo/gbyGen.nim program).
18. cosmic_quanta ◴[] No.43721245{3}[source]
I'm not going to sell you on anything. All of the things you've mentioned are true. Loosely, the multitude of string types and the state of the standard library come from the same place: the language is 30+ years old! There are many warts to be found.

However, if you decide to start learning, the path is hard, especially if you come from a non-computer-science background like me. I attempted to learn Haskell twice; I bounced off the first time, quite hard, and didn't try again for years.

What worked for me is a combination of two things:

* Having a goal in mind, that has nothing with the choice of language. For me, it was building a personal website

* The book Haskell Programming from First Principles [0]

and if you have more questions, reach out.

[0]: https://haskellbook.com/

replies(1): >>43725787 #
19. butterisgood ◴[] No.43724195{3}[source]
Hence GHC extensions? Overloaded Strings don’t help? It’s been about 20 years since I wrote Haskell in production.
20. butterisgood ◴[] No.43724201{3}[source]
Can’t stand Python. Have to use Python. Wish it would DIAF to be honest.
21. revskill ◴[] No.43724409{4}[source]
Could u be more specific ?
22. tasuki ◴[] No.43725787{4}[source]
> Having a goal in mind, that has nothing with the choice of language

Yes, yes, that's exactly what my encounters with Haskell looked like. The last one is ~1k lines of code backend for a personal project. I feel that's about as much as I could manage at this point.

> The book Haskell Programming from First Principles

That book is getting recommended all the time! I'm concerned if it's perhaps a little too basic for me. (I understand monads, monad transformers, have some notion of final tagless and free monad. Yet I get perpetually confused by various relatively simple things.)

I guess what I'm missing is haskell-language-server to help me a little. Here I'm confused about the interplay between `haskell-stack` (which is in Debian repos and which I think I'd like to use), ghcup, cabal, and haskell-language-server.

23. kreyenborgi ◴[] No.43734571{3}[source]
The manual string conversions are annoying. But with https://hackage.haskell.org/package/string-conversions-0.4.0... you just add a `cs` and don't think more about it.
replies(1): >>43736772 #
24. tasuki ◴[] No.43736772{4}[source]
Oooh this is very nice!