Live data from Hacker News

Haskell for a New Decade [pdf]

dev.stephendiehl.com

141–150 of 190 posts

Re: Haskell for a New Decade [pdf]

#141
post #37

I think the focus on Haskell is missing the mark a bit. Haskell is about programming language researchers and enthusiasts having a excellent example language to try out ideas. Over the years it has turned into a production ready platform. As the PDF shows there are many languages spun off Haskell and it doesn't even mention them all. Then there are language features in C# and Java, Typescript etc. that are coming acr…

Counter point on "investment": I was in a Haskell team at Google, and have trained groups at various companies professionally. From that experience, for a normal developer with working experience in Java, Python, or C++: * It takes 2-3 weeks of full-time onboarding (half with a coach, half self-study) to work on a typical industrial Haskell project. * It takes around 3 months of full-time participation in such a proj…

Incidentally, I am learning Haskell right now. And fwiw don't have a CS degree.

I think the difficulty of Haskell is overrated. It's just different. The crowd who complain about Haskell being hard despite x years experience are the same people who speak English and think Mandarin is hard.

And yet 1.7+ billion people speak Mandarin, and most linguists agree that English is actually the harder language owing to its more branched roots.

Haskell is what happens when you go full lambda calculus, and the dedication to referential transparency really forces you down some interesting paths/abstractions. It's also worth noting that other functional languages like OCaml and lisp do not force purity so the idioms are not as extreme.

The impedance mismatch essentially boils down to Turing Machine vs Lambda Calculus and as such you don't find many familiar friends when switching camp (to begin with, at least!) The Haskell idioms are very different and the consequences of referential transparency ripple throughout the way you need to think about computation.

It's also worth noting that Haskell is a language laid bare - much of the features and abstractions are plain-old functions which means you can "just" duck into them, implement them for yourself or read them as libraries. But what we often forget is all the abstractions we needed to learn when grokking "programming" (which was probably imperative style programming) the first time round. Most people have moved on from the time when trying to conceptualise what an object is or how methods work or even working with mutable state. When you get to design patterns - some of the implementations are quite complex the first time round. Eg the visitor pattern/double dispatch is not particularly simple when you sit down and manually expand the execution of those calls and yet when you use it, it's quite simple.

When we program with objects, most of us don't stop to think about vtables anymore* we just use the object to solve our immediate problem.

The more I see of Haskell, the more confident I am that it just uses a very different set of abstractions that you can just use and forget about except you get the benefit of a HM type system and referentially transparent code. It's also nice that that itself somewhat forces you towards a more functional-core imperative style architecture where your business logic is pure and mostly happy path code and your boundary is a bunch of monad imperative glue.

I think at the end of the day FP makes the hard things easy and the easy things hard. But as the Turing Machine and Lambda Calculus are equivalent then being adept at both schools is like having twice the arsenal for dealing with a given problem.

*naturally when performance becomes a problem you start to unravel abstractions.

Re: Haskell for a New Decade [pdf]

#143

Earlier quoted context omitted.

> Instead of Haskell we should be thinking of programming language research and how to get the best ideas into our mainstream languages. I believe Scala is already such a language. > There are even features not in Haskell proper like Liquid Haskell that would be interesting to have in C# or Typescript. There are many advanced type system feature are very hard or mathematically impossible to implement in main stream l…

> For example, Hindley-Milner languages cannot add sub-typing Subtyping? Haskell has ADTs.

ADT cannot be extended. Maybe I should say Algorithm W instead of Hindley-Milner languages - Haskell added extensibility via Type Classes.

Re: Haskell for a New Decade [pdf]

#144

I think the focus on Haskell is missing the mark a bit. Haskell is about programming language researchers and enthusiasts having a excellent example language to try out ideas. Over the years it has turned into a production ready platform. As the PDF shows there are many languages spun off Haskell and it doesn't even mention them all. Then there are language features in C# and Java, Typescript etc. that are coming acr…

I can't speak for everyone but for me the type system is not what made Haskell difficult. I loved it. What made it difficult was laziness. I'd find myself always trying to reason about execution (even though most of the time you probably shouldn't). Laziness might even be fine in a world built around it, but for a language to be practical it has to interface with systems that are not designed that way (numerous exter…

Personally I don't like the C# nullable types as they are right now. I would prefer them to be just a library type instead of a language construct. With the language construct there seems to be no way to use fmap/bind (Select/SelectMany in LINQ) on nullable types while that would be trivial if they had used an Option type.

Maybe I'm missing something?

Re: Haskell for a New Decade [pdf]

#145

Earlier quoted context omitted.

Anecdata point: I'm comfortable with lens at a very basic level, and if you have a good grasp of "normal" Haskell you can just compose lens operators and use combinators by playing the usual "type tetris" game of "what fits here?" and eventually you pick up a few idioms that are enough for most normal lens usage.

There are many people (at least that from the developers I know) who need to understand things fully before they 'can' use them. One of my friends is mentally stuck for 30 years on a platform because he cannot use what he does not fully understand. He tried Haskell (a few years ago) but instead of going through exercises or just trying to implement something, he read a book and noticed he did not understand basic (mo…

So they're essentially non-functional with today's technology stack? I think it's safe to declare the entire thing essentially incomprehensible to a single person. Sure - you can understand all the basics, and achieve expertise in a lot of it, but modern software and computing is essentially fractal in its complexity. Even when you think you understand, it often ends up being an abstraction which is re-written by some routine further down, deep within some area which raises even more questions.

Re: Haskell for a New Decade [pdf]

#146

I think the focus on Haskell is missing the mark a bit. Haskell is about programming language researchers and enthusiasts having a excellent example language to try out ideas. Over the years it has turned into a production ready platform. As the PDF shows there are many languages spun off Haskell and it doesn't even mention them all. Then there are language features in C# and Java, Typescript etc. that are coming acr…

I'll respect your opinion but sign up for the "not what other people want" crowd. I started learning Haskell last week. I have a small rest service I need to write and I want to try something new. Why Haskell? Because I miss seeing excellence/purity in computer languages. Nearly 10 years ago I jumped out of the Smalltalk balloon. It was one of the only languages where Object Oriented felt like a paradigm shift (CLOS…

Haskell is probably the exact opposite of what you are looking for. It's basically a pile of every academic's pet language feature. I would suggest you try Common Lisp or Clojure, which will probably be closer to what you are looking for.

Re: Haskell for a New Decade [pdf]

#147

When will Haskell get a different spokesperson? Stephen isn’t effective in this role. These posts have jumped the shark to the point when I see a big Haskell post on HN and see stephendiehl.com it’s just time to tune out. For Haskell to succeed, it has to move away from rigid commitment to various pure functional paradigms and move to eager execution by default. But Stephen does not help this, just preferring to inst…

Right. If you want to talk about your language, there are two effective ways:

1. Talk about it in isolation: we enjoy Haskell, here's where we think it should go.

2. Place it in the context of the wider software ecosystem, as in these are the pros and cons, barriers to adoption etc.

What isn't effective is doing #2 while not trying to really engage with reality. If you just assume, contrary to evidence, that Haskell is the right way and the reason it's not adopted more is that everyone insists on doing things the wrong way, you will not convince anyone who doesn't believe this fairy tale already, and worse, you'll ensure you won't help yourself, because you focus on the issues you wish you had rather than the issues you actually have. Self-reflection is supposed to help you, and it only helps if it's a long hard look in the mirror. The approach of, "things aren't going the way we hoped but our assumptions could not possibly be wrong so we'll just examine everyone else's" is not generally useful, as it's nothing but a waste of time: you know you'll end up exactly where you started.

Re: Haskell for a New Decade [pdf]

#148
post #121

Earlier quoted context omitted.

What do you see as the deficiency of kotlin's handling of nulls?

Nested nullable types collapse to the same type, meaning it's very easy for generic code to contain really subtle bugs. If you have some generic code that has a T? and assumes that whenever it is null it is not T, this assumption will be almost correct and very easy to miss during testing. Also, it's very common to have option-style code and as your code evolves you need to refactor it to either/result-style code (th…

For me, there are two killer reasons for Kotlin to handle nullability as it does: smooth host platform interoperability and zero overhead. The existing huge mass of JVM libraries use null, so by embracing that rather than adding a new wrapper object like Scala's Option (or even JDK 8+'s Optional), Kotlin works smoothly with all those libraries. And with some annotations, Kotlin's nullability support can be applied to those existing libraries. As for zero overhead, an Option or Optional is another object, and the overhead of that object can't be completely optimized away by the JIT. And both of these concerns apply to all of Kotlin's target platforms.

Re: Haskell for a New Decade [pdf]

#149
As a seasoned C++ programmer, that occasionally plays with Haskell, here is a question?

Has finally Haskell the problem of how to do destructive updates or not?

If it cannot do destructive updates, I am not interested. The kind of software I am called to build always requires destructive updates for performance reasons and secondly I am so used to assignment and all the design patterns around it that I don't think I should bother with something that does not provide that.

Re: Haskell for a New Decade [pdf]

#150
post #37

Earlier quoted context omitted.

Counter point on "investment": I was in a Haskell team at Google, and have trained groups at various companies professionally. From that experience, for a normal developer with working experience in Java, Python, or C++: * It takes 2-3 weeks of full-time onboarding (half with a coach, half self-study) to work on a typical industrial Haskell project. * It takes around 3 months of full-time participation in such a proj…

> It takes 2-3 weeks of full-time onboarding > It takes around 3 months of full-time participation Compare that to Erlang's half a day to a day for onboarding, and one to two weeks before pushing stuff to prod. I can't imagine any company that could afford three full-time weeks of onboarding. > investing 3 months for life-long increased productivity (even if it's just a few percentage points; most feel the effect is…

"Compare that to Erlang's half a day to a day for onboarding,"

Erlang's a half day for onboarding if you're onboarding a Haskell programmer, not because Haskell programmers are that awesome but because they've already had to learn the hard things involved in Erlang to work with Haskell [1]. Otherwise, that's ludicrous nonsense. Most programmers will need several hours just to figure out how to write the equivalent of lists:map in the new Erlang, immutable world, more hours to figure out how to write things non-trivially with it, and a good couple of weeks at a bare minimum to figure out how to structure applications in an OTP world, then some more time to figure out how to debug it.

It's not especially harder than learning SQL or the latest Javascript framework or other things that aren't Algol-descended languages, but it's nowhere near that easy.

[1] I went the other way. I found Erlang an excellent introduction to Haskell; you get to absorb some of the challenges like working in pervasive immutability in an environment where you're not also swallowing a complicated type system or strict effects separation.

Post reply on HN