3 ms·
Haskell and Python are two languages that couldn't be more different. Are there developers that prefer both and constantly switch between them? Besides the obvi
by bad_user 11y ago
Haskell and Python are two languages that couldn't be more different. Are there developers that prefer both and constantly switch between them? Besides the obvious that Python has one or two cool libraries, why would anybody willingly do that?
- lmm 11y agoThey both allow you to naturally express idiomatic-functional code (in their own ways) in a way that you can't (or couldn't until recently) in C#/Java/etc. The Python and Haskell versions of the method example from the post look much more similar to each other than either does to the C# version. There was a time when I wrote Python and ML and switched between them. Python had good library support and was slightly faster to write (I was fearless back then, but it seemed to work out ok), particularly for basic CRUD-type tasks. For cases of more involved business logic (really, any business logic at all) I needed higher correctness guarantees and would switch to ML. It worked well enough.
- rprospero 11y agoHello, I'm that guy who voluntarily writes a mixture of Python and Haskell in his day job. For me, it's about recognizing the strengths in both languages. You mentioned Python having "one or two cool libraries", but that's quite an understatement if you're doing any sort of numerical work. NumPy and SciPy are incredibly powerful, fast, and consistent. While hMatrix and Accelerate are both wonderful packages and have made some great progress, they don't have nearly the community support that Numpy does. On the reverse side, when I'm dealing with any sort of interactive system (e.g. Web Scraper or Motor Controller), I immediately reach for Haskell, since it makes those kinds of applications so much easier. For me it's mostly about just finding the right tool for the job. And trying to avoid any job where the right tool is Fortran.
- exDM69 11y ago> On the reverse side, when I'm dealing with any sort of interactive system (e.g. Web Scraper or Motor Controller), I immediately reach for Haskell, since it makes those kinds of applications so much easier. I find this a bit surprising... can you tell a bit more about these projects? I tend to do the opposite, I reach for Python when I need interactive stuff or need to interface with the "real world" more (network connections, etc). And I use Haskell when I have projects that have well defined inputs and outputs.
- ZenoArrow 11y agoAlthough people may be reluctant to admit it, I suspect a large part of the 'similarity' is significant whitespace and the lack of ceremony when defining functions.
- exDM69 11y ago> Are there developers that prefer both and constantly switch between them? Yes. I do. I regularly use about half-a-dozen different programming languages, with C, Python and Haskell being my weapons of choice (when I have a choice). I use Python for quick hacks where performance doesn't matter. I could do with Lua, Ruby or Perl, but I prefer Python because I know it and it's "batteries included". I've used Haskell a lot, and I use it for more complex tasks such as parsing or compiler projects. Back when I was at the Uni, I really aced some courses because I could do programming project works really fast, while relying on the static typing and some ad-hoc testing with QuickCheck. And I use C because there's no alternative for it in my day job (technically, Rust could do it now, but there are non-technical issues that prevent it so far). I also use it for some performance intensive scientific/math stuff as well as computer graphics.