I am growing dissatisfied with Python, and looking to learn a new language. I’m interested in functional programming, so I think this will be one of Haskell or OCaml.
If anyone can weigh in with some thoughts, it’d be appreciated. I don’t have particularly clear-cut requirements here, but here are some things I have been working on, as well as other thoughts I have been having about this choice, that may influence someone’s advice.
Although I am not motivated primarily by a dislike for Python (I like Python most of the time), here 2 things that genuinely bother me about it:
* Getting tired of the lack of real static typing. I suppose I could/should set up a MyPy daemon for everything I do that’s more than a simple script, or try Pyre? I’m not sure how much of a pain that would be.
In any event, it’s still kind of annoying for the language to not actually include this concept. The type annotations feel tacked on (because they are) and at the end of the day, it’s still possible to get runtime errors that should have been checked at compile-time.
* The import and PYTHONPATH stuff is crazy. In particular, I feel like I am constrained to structure projects in a way that makes sense. I’ve just found a way that works for Flask web applications and I am sticking with it because fiddling with the structure too much leads to import errors.
Maybe I would have more gripes if I were smarter. Things I do like about Python:
Standard library seems pretty good (?), especially in terms of DSA (I’ve been joking lately that solving Leetcode problems is where Python really shines)
The code tends to be readable (or at least, it is possible for someone to write very clean, very readable code).
The main things I have been working on lately have involved PDF/document processing in the context of web apps. I also have some designs to do some ML/NLP stuff in a domain/industry where I have domain expertise.
My current thoughts:
Haskell has a lot of learning materials, and stuff like HaskTorch exists for my ML/NLP interests. Primary downside is that it’s purely functional, which means it can be less flexible and makes it less likely it can replace Python as my go-to language. Of course, that might be a plus from a learning perspective, as it would force me to learn to accomplish things in a purely functional way.
OCaml is more flexible in terms of paradigm, which has pluses and minuses from a learning perspective. Seems more likely to be a practical choice.
I would not say employment prospects are top-of-mind here. I don't think either are widely-used enough for it to matter; C++ would be a better thing to add to my resume for a lot of the jobs I am interested in; and I am of the general opinion and belief that I should prioritize foremost what I enjoy and have genuine interest in, both for QOL and because money will then follow.
I surveyed many free and paid-for references to build my foundation, before picking John Whitington's "Haskell From the Very Beginning" (https://www.haskellfromtheverybeginning.com), because it "takes a no-prerequisites approach to teaching the basics of a modern general-purpose programming language".
I am also using Replit's "free-tier" as my Haskell learning environment. Replit let me jump right into the fun of Haskell, while postponing dealing with installation/configuration nuances until absolutely necessary. This is also letting me do learning any time I have a free moment from wherever I last left off on any computing device I have handy, including my tablets or smartphone.
So far, my learning experience has been a joy.
If you decide on OCaml, Whitington also wrote "OCaml From the Very Beginning" (http://ocaml-book.com), which available via free pdf or HTML thanks to the OCaml Software Foundation, and looks to be structured similar to his Haskell book.
Hope this helps.