Haskell vs. procedural programming in the real wor

2019-02-01 16:26发布

These days I'm getting seriously into functional programming.

While I'm really excited about Haskell and the possibilities it seems to offer, I can also see now that it is going to take me a while to learn. In an SO question on How to learn Haskell an answer states that it'll take months if not years to actually "master" it.

Now, I know C, PHP, some object oriented stuff, etc. And having been told that Haskell isn't much used out there in "the real world", will I be better off improving my skills in the regular languages I know? Is Haskell worth the struggle?

In this question on Why people think functional programming will catch on the conclusion seems to be that functional programming will "catch on". But surely procedural programming will stay on top, right?

EDIT: keparo nicely clarifies my question to: As opposed to procedural languages, will it be valuable for me to study Haskell and functional programming paradigms?

13条回答
劫难
2楼-- · 2019-02-01 16:51

You probably shouldn't expect to use Haskell anywhere nearly as often as a C family language in professional settings. If the question is whether it will be valuable for you to study Haskell and functional programming paradigms, the answer is yes. You can apply your enriched understanding of programming to all of your work.

查看更多
在下西门庆
3楼-- · 2019-02-01 16:53

As opposed to procedural languages, will it be valuable for me to study Haskell and functional programming paradigms?

Not unless you want to be miserable. Luke Plant says, in Why learning Haskell/Python makes you a worse programmer:

So, learning Python and Haskell has demoralised me and encouraged me to write code that is bizarre and difficult to understand...

(This is not entirely a joke.)

查看更多
Root(大扎)
4楼-- · 2019-02-01 16:57

Haskell isn't as hard as people like to make out to learn. Haskell opens up a new world that you never knew existed for you. It's as valuable to learn as any other language. You might not find a job requiring you to do Haskell programming, but does that really mean a language isn't valuable?

Haskell will teach you a lot of new stuff, and it will show you how to program even better in the languages you /do/ work with. You can do your own personal projects in your spare time with it.

Haskell isn't really used much in the "real world" if you define "real world" as "cash generator". So if that is your objective, then you might have to rethink objectives :p

Also, I don't really like that part of chosen "how to learn haskell" answer. It takes months to years to master any language, not just Haskell. Depending on how you define "master". I can use Haskell to a pretty good degree of efficiency and I've only been learning it for a month, and I've been taking it slow even.

查看更多
【Aperson】
5楼-- · 2019-02-01 16:59

I can see that functional programming can be a plus in a production environment if it's very easy to use by non functional code. MS could see that too when they came up with F# I guess.

Since they both compile to IL, you can handle problems that ask for a functional approach functional and use those solutions very easily in your procedural code.

In that way functional code can easily find its way in a production environment a bit at a time

Therefore, and since the userbase of MS is that big, my guess is that if F# will not catch on in the very near future, that Haskell won't either.

查看更多
对你真心纯属浪费
6楼-- · 2019-02-01 17:00

Some people enjoy programming in Haskell. If you can choose your environment, and enjoyment is a consideration, then maybe you should hop in.

Many programmers are not in position to choose their tools and enjoyment is not a factor for their choices. Many of them get to use C/Java/etc at their workplace for the "core project source", but then also choose or need to use Python for "scripts" such as build-scripts with SCons, other scripts that generate Java/etc code, testing systems, proofs-of-concepts, etc.. And in other places Python is also used in the "core project".

In 8 years, it will be Haskell, not Python, which will be "coming to you". But you can come to it sooner.

查看更多
太酷不给撩
7楼-- · 2019-02-01 17:02

As opposed to procedural languages, will it be valuable for me to study Haskell and functional programming paradigms?

If having an expanded skill set is valuable, then: yes.

One advantage you might pick up: parallel and concurrent programming. Procedural languages of the past tend to have no clear notion of side effects, as a result writing parallel programs in them is difficult to do correctly. Functional languages (in particular, ones that limit side effects like Haskell) have a lot more to say about productive parallel programming.

Having that skill up your sleeve can't hurt.

查看更多
登录 后发表回答