6 ms·
Haskell is fun, lots of fun, but it is not a practical language by virtue of it being strongly typed. By practical I mean strongly typed PLs are not forgiving
by wellpast 7y ago
Haskell is fun, lots of fun, but it is not a practical language by virtue of it being strongly typed.
By practical I mean strongly typed PLs are not forgiving as your world and perceptual view of the world changes over time -- as it does for any business.
Your program must pass a proof to execute. For the most part you do not need to explicitly express your types; Haskell can infer them. This is often pointed at by Haskell enthusiasts as some kind of nicety. But it's not because (1) the types are still there; your program still has to cohere wrt to the type system; (2) strongly typed programs with explicit type annotations are much easier to read and manipulate, so you should use them anyway.
As your world and assumption changes over time you will find yourself having to do a ton of work to have everything cohere for the type proof again. Haskell enthusiasts also like to say things like with strong typing "Refactoring is easier". This is incorrect. What they are pointing at is that Haskell will of course catch certain (type mismatch) bugs during a refactor, but it will also find many many things that would not be a bug were you using a lighter or no static type system. So ironically this in my experience discourages refactoring because you become exhausted from all the unnecessary labor required to make rather nominal changes to your domain model.
Dynamic languages on the other hand, when in the right hands, don't obligate this whole unnecessary labor of effort.
I feel that there's an elephant in the room whenever I talk to someone who is enthusiastic about strong typing in a business or real world context. And that's this: that their enthusiasm is more to do with the pure fun of manipulating a type check/prover and playing in these weeds than actually getting real stuff done over time.
Another common retort from the strong typing enthusiast is they will point back at a dynamically or loosely typed system they've worked on and point out what a mess it is and then proceed to show how they don't run into certain classes of bugs any more, like null pointer exceptions. What goes unanalyzed is the competence of the team that made the mess, that it was the fault of the skills at play and not a necessary fault of not having types. What also goes unanalyzed is whether the extreme cost of playing the strong typing game is worth an occasional NPE (which are of the immensely easy and fixable kind of bugs) here or there -- in a standard business (ie, not mission critical) context.
I realize this is going to be hotly contested and that I'm stepping on toes here, but I think all of this is true.
Learn Haskell by all means, but be honest with yourself when comparing it to the successes of more pragmatically designed languages. This should also be no surprise; Haskell is a research langauage born in academia, NOT born out of long practitioner experience. Compare to Elm -- another strongly typed language for the frontend -- which was born out of a doctorate with limited real world experience. Then compare to, say, a Clojure (another esoteric language) but which was born from extensive pragmatic experience and look at the choices it made and how in many cases they run against Haskell's.
- danharaj 7y agoThis is astonishingly ignorant.
- xedrac 7y ago> with strong typing "Refactoring is easier". This is incorrect. I can't tell if you're just trolling, but have you ever done a large refactor in a dynamically typed language such as Python? It's a runtime minefield, taking a huge amount of testing effort to gain any level of confidence that you got it correct. In a language like Haskell or Rust, it's usually as simple as getting the thing to compile.
- wellpast 7y agoThis is exactly my point. If your goal is to optimize for a future “big refactor”, then your problem is a present-day skills problem, not a PL issue.
- bam365 7y agoIt seems like you're arguing that dynamically typed languages are best because they don't get in the way of programmers who are good enough to pretty much never screw it up in the first place. Am I misunderstanding you?
- wellpast 7y agoMore or less, yes. But I also worry about the team that thinks a statically typed language is going to save them. I think at the end of the day you have to do this job well or you don’t get any guarantees. I’ve seen people make equal messes in strongly typed languages and dynamic; the PL is not the thing. But one thing that is true is that strongly typed languages tax you strongly; anyone who says otherwise (and enthusiasts often do) is lying even if to themselves as well.
- lacampbell 7y agoIME a code base with high test coverage lets me refactor far more securely than an expressive static type system. Static typing is useful, but if I had to pick one it would be tests all the way.