130 points · by k0t0n0 · 8y ago · 109 comments
But i don't think i could recommend it for the enterprise. not honestly. I tried to do a professional project in Haskell once. it was a good fit, since it was about parsing and generating configuration. However I was still new to it. the bottom line: it's just not that great for newbies. since most people are going to be newbies at it, i could not recommend it at all. sometimes i think the language even goes over my head, and I'm supposed to be a pretty smart cookie.
OP makes 'they are not going to be productive for months' sound like an obstacle to overcome. But if I tell management the honest story in advance and they will obviously not give me the greenlight.
But i suppose it is a language that's a reasonably easy sell to management if you hype up the reliability stemming from the type system and skip over the downsides. managers dont know much about programming, but they hate incidents even more than developers. if you are honest, you have to tell them that in practise operational problems become more likely. I mean: ever tried to install ghc on a centos server behind a firewall?
If i have to recommend something now it would be python. because it's easy and because i started using it for my personal stuff. i know lots of languages and that's what i end up coming back to if i need to do stuff quickly.
OP doesn't even mention the real advantage to introducing Haskell. Few colleagues will end up being good at this, so if a piece of critical software is written in Haskell and you are the only one who is a great Haskell engineer, it increases your negotiating power in the company. people won't be able to get around you and it will be hard to deny a request for increased compensation.
I don't think that disqualifies it for enterprise. People will start as newbies and they'll have a very difficult initial hump to get over but once they've been using it for a few months they'll be productive and after a few years they'll be very productive. Unless turnover is so bad that a substantial portion of your workforce is always "new", use of Haskell should be a net positive for a company.
There was a study a while ago (http://www.cs.yale.edu/publications/techreports/tr1049.pdf) that had programmers experienced in each language solve a simplified but non-trivial problem for the US Navy in their given language. Haskell was rated quite highly. There was even a case where a newly-hired college graduate was given 8 days to learn Haskell, with assistance from an experienced Haskell programmer. The college graduate was then asked to solve the problem using Haskell and still performed very well.
So I don't think it's impossible to learn Haskell quickly either, it just requires access to an experienced mentor, something an enterprise could provide.
Yes, he does - contrary to the non-technical political motives you outlined - he outlines the importance of a strong type system for maintenance and refactoring—A property much harder to achieve in something like python.
I think your own experience of having some difficulty bringing your previous skills to bear on the language is not so uncommon—This is why mentors are so important.
Of course a typed language is going to have a better type system than an untyped language... When you compare to a language like Java, your argument doesn't shine.
mmm.
> If i have to recommend something now it would be python. because it's easy and because i started using it for my personal stuff. i know lots of languages and that's what i end up coming back to if i need to do stuff quickly.
Python and Haskell are useful in completely different domains.
my comment is necessarily about applications where a comparison is useful, not those specialized financial applications at investment banks where Haskell is popular for undoubtedly good reasons i have absolutely no clue about.
Haskell is a very good general purpose programming language for the reasons the commenterd gave in the thread. It is great for all kinds of general backend tasks. The kind of tasks one would associate with Java would also be a great for for Haskell.
Python is also general purpose. It's dynamic typing is especially good in specialized domains of rapid prototyping and exploratory data analysis (perhaps useful at investment banks too).
Only briefly; I expect to be proficient with a tool for most of my time with it. If I constantly find myself near the bottom of the learning curve, that means I'm impulsively choosing and abandoning tools way too quickly for the payoff.
At the other hand, if you filter your hires by people that know it, you are assuring you won't get a newby.
It ticks, or half ticks, most of the points in the "Benefits of Using Haskell" section. Whilst also coming armed with C# interop and integration with the .NET ecosystem in which they were already invested.
The same goes for mutability, it is there and you should certainly use it when it makes sense but it is not the default.
This is also true for Haskell. It's not especially hard to get and use mutable variables, they're just not something that most tutorials cover.
I'm not familiar with F# but Scala at least has a far inferior compiler (compared to GHC). There are a lot of functional techniques that simply don't make sense when you don't have dedicated tooling to support them.
Laziness is, in my opinion, the wrong default.
At least some figure indicating that a Haskell app is less prone to bugs, etc.
Otherwise why not throw Typescript at it?
The end result is _usually_ better (e.g. Lenses are in almost all cases an improvement over getters and setters; Functors, Monads and Traversable are an improvement over imperative control flow), but damn it it doesn't take a while to get your head around those concepts.
Even non-trivial type-level programming can be picked up by complete novice in Haskell in less than month. I experimented with that.
I work for a large MNC bank and in my prev stint with a different department, for whatever reason I had to inherit a not-so-trivial Haskell code-base which gave me really hard time. Although it was in BAU mode, maintenance was difficult and hiring was even more difficult, I couldn't even get help from other guys from different projects as they are all mostly Java guys, anyway I moved and I know the new manager is trying hard to convince his boses and business for getting fund to migrate it to Java.
> unless you know you are going to stay there (in the same project) for very long time and you know you can hire/retain and train new people in Haskell.
It also sounds like maintaining a haskell code base is some rocket science. It is not. There are both extreme, but also conservative ways of doing things, and if you pick the conservative, then the people staying won't have that much trouble coping.
- it's very hard to hire people
- lack of libraries
- lack of support / community
- difficult learning curve for the language
Where I work some teams are dropping Scala because hiring Scala dev is hard, so imagine Haskell...
Hire good developers. They will learn whatever technology your company uses and/or built.
A better one would be: "Hire good developers. You can invest in teaching them whatever technology your company uses and/or built."
Otherwise you end up with companies that hire good developers who don't know the tech stack and expect them to be 110% productive in one week with no investment from the company in training them. Then, even if the developer can keep up with demands they end up writing sub par code due to unfamiliarity with the tech stack.
That being said, if you have the money, Haskell developers will absolutely follow - and in some domains the project will actually be cheaper.
Besides which, an employee with a fully-loaded cost of $200k/yr can be sent to a one-week external class for well under $15k including salary, tuition, travel, and expenses. That's far less than the cost of acquiring and onboarding that employee; and if you don't care to train your staff, they'll jump ship for an employer that doesn't suck the stars out of the sky.
The community is one of the more helpful and responsive ones I've come across. You can generally jump on IRC and find either the people who wrote the stuff that's tripping you up (e.g. Ed Kmett for Lens and MTL), or people who know that stuff backwards and are quite happy to help (e.g. Tony Morris).
There are high quality libraries for _most_ common problems. A lot of them are vast improvements over what you'll find in other languages (e.g. Aeson for JSON serde & manipulation). Stuff like Amazonka often runs ahead of Amazon's official libraries, because it compiles directly from their API spec.
Are you going to run across holes? Sure. My team maintains a bunch of open-source libs for where we've found them. If you just want to do connect-A-to-B programming, Haskell is not for you - occasionally you're going to have to go and implement something yourself.
How do you get past writing anything that isn't java,c/c++ and python without being a cowboy. In my short experience writing with any other language gets a somewhat negative response.
If FP is the goal, then Clojure and F# would be FAR better suited.
My current challenge for my next job is to get an opportunity to work with Go professionally, because try as I might deploying Python reliably remains a colossal pain in the lower.
I'm a big fan of team decisions for tooling and languages used and I'd personally have some problems if someone told me we'd be switching languages next month. Well, unless I already knew the language and/or tried and liked it - but that's just a random coincidence that I like using and learning a lot of languages.
We should have more of these from seasoned developers. There are a lot of hard core math/type theory guys on reddit and elsewhere (who I have lots of respect for), but in an industry setting there are (1) features to deliver and (2) people to be dealt with -- outsmarting has little place with those. You have apparently succeeded in doing the jump in this setting.
- Reduce programmer cognitive overload
I don't know how he could honestly say that. Haskell is much more cognitively demanding than other languages from my experience
A lot of the benefits he talks about he could get from F# or Ocaml, which are much simpler to learn and use for a team
That being said, I think haskell does have unique niche in industry: if the company does something very complex and cognitively demanding and requires the best and the brightest, using haskell can be a way of luring the best and brightest to work there
f :: A -> B
There is nothing ambiguous about this function when considering application state and IO. You cannot call fireTheMissiles inside it, it performs no side effects. It simply takes an A and returns a B.The headphone rule always comes to mind when talking about this. Typically developer productivity is killed when a developer is interrupted because they are trying to maintain a complete picture of time and space in their head. This problem is much less so with Haskell because you can just glance at the inputs and outputs of the function you were working on and get back on track immediately.
In the sense that you are implying, that the language itself is cognitively demanding, I would argue that is only a beginner problem. Once the core concepts are internalized it's actually very easy to use.
Where it gets hard and becomes a mental burden is when you start going off the map and looking into some of the more advanced concepts, like type level programming, which to date we haven't had to pay attention to or use on my team.
I'm definitely not a haskell beginner, and I know others who are definitely not beginners and they feel the same way.
I'm talking about the language as a whole. With all of the extensions available, there's plenty there for even seasoned haskellers to learn. Sure you can get used to anything, but I've found the more advanced type features, and higher kinded polymorphism, to make code and type errors harder to reason about. Sometimes type inference screws up in ways that makes it hard to figure out whats going on.
How?
I think Haskell code can be overcomplicated sometimes, but that's not mandatory.
Also, another big responsibility is teaching the rest of your coworkers. Classes, hackathons, documentations, etc.
The bulk of being a good-engineer is productivity, by reinventing the minimal amount possible. Highly efficient engineers are very accustomed to their tools (IDE, language, framework, database and DB drivers, webserver, deploy system, logging).
Forcing a team of engineers to use a new language, IDE, framework, particularly one that has minimal backing, is something I would consider a "fireable" offense (i.e. costing the company hundreds of thousands of dollars for personal amusement).
And also, if you did want to go functional, why not something used by literally any professional company? E.g. Twitter on scala.
Can we cool it with using "literally" to mean "figuratively"? You may have heard of Facebook or Standard Chartered for instance, unless you consider them both unprofessional. Sure, it's less common than other FP languages, but Haskell is used for non-trivial things by non-trivial companies.
I know nothing about Facebook using Haskell. Last I checked they use a PHP-derived language called Hack.
I'm not sure what else they use it for, but they hired Simon Marlow, one of the main guys behind GHC a years ago. It's still not their primary language, but restricting the interpretation of "professional" and "uses" to what you had in mind is not the most interpretation of your comment to me.
But I think Scala has the major problem that Perl has, take 5 developers and you get 6 different styles. I went from "Scala is horrible" to "oh, this actually looks nice" to "omg, what the hell" and so forth. Look at a random library as a beginner and think "is this really Scala"?
And that's even ignoring the problems with sbt, binary compatibility, and so on. Yes, there were some success stories. Also some stories of replacing Java with Scala, but I've heard nearly as much "well we replaced it but we don't know if it's really better".
But all that is aside from my main point, which was changing tools on people is almost never justified. Unless you're writing a web app in ASM, you usually should stick with your language.
- Scala is not an easy language to learn unless you just use it as a "better Java" with syntactic sugar, in which case it cannot be considered to be in the same class as Haskell. The same is true of many other languages folks are proposing, like Clojure or F#. It might be easier to bang something out with Clojure than Haskell, but I don't think it's any easier to master than Haskell.
- Your estimate of the cost (hundreds of thousands of dollars) assumes there's no benefit to the switch. There may or may not be, but you didn't even account for that possibility.
- Highly efficient engineers are also efficient at learning new tools, frameworks, IDEs, etc., because for many developers that's part of daily life.
The question is how you get to there from here.
6-8 years ago I wrote "better Java" style Scala. For the last couple of years I've been writing Haskell-like Scala and enjoy all the cited advantages. But, crucially, I was able to remain productive the whole time, and do all my learning on the clock while working on real, useful projects. Nowadays I could probably get by in Haskell (I would still choose Scala over Haskell, but that's a separate discussion), but if I'd tried to start with it in the first place I would never have got off the ground.