Live data from Hacker News

A couple million lines of Haskell: Production engineering at Mercury

blog.haskell.org

181–190 of 249 posts

Re: A couple million lines of Haskell: Production engineering at Mercury

#181
post #37

I know this is not the point of the article, but I find the anecdote in the beginning about null pointer errors somewhat ironic. Haskell's solution to null pointers are option types (`Maybe x` in Haskell), but these are known to be suboptimal. In languages with option types, if you want to weaken the type requirement for a function parameter, or strengthen the guarantee for a return type, you have to change the code…

This is really a non-issue in practice. In the olden days, you’d just make the change and then spend a pleasant hour or two fixing the callsites by responding to compiler errors in a pretty low-thought, mechanistic way. Nowadays you can outsource that part to a coding agent and get on with your life. In any case, the fact that the compiler knows what code needs to be updated is a real superpower.

Well, it's still a suboptimal solution. Moreover, if you are modifying any library functions, there is a high probability that you can't change the call sites at all because you simply don't have access to them.

Re: A couple million lines of Haskell: Production engineering at Mercury

#182

It's a double-edged sword. Two million lines is a major feat. It's also represents a significant maintenance burden. The advantages to Haskell are theoretically obvious. The downsides are harder to intuit. The temptation is to model _everything_ as types. The codebase itseld becomes a _business specification_, not an application. Every policy change is a major refactor (some of which are shockingly high-touch thanks…

[deleted]

Re: A couple million lines of Haskell: Production engineering at Mercury

#183
post #6

It’s hard to imagine what two millions lines of Haskell could possibly be doing. I mean that’s a lot of code and I have the impression that Haskell is “tight” meaning a little code can do a lot. Maybe they have a lot of libraries to do things like json serializing/deserializing, rest api frameworks, logging etc?

Nit: the quality of a language that you call "tight" is usually called "expressive." You can use few characters to express a relatively very abstract idea. Some people call this "high-level," too. I will say, though, that 2 million lines of code is much less code than it sounds like at first glance, especially for a company in a highly-regulated space like finance, plus a few years of progress.

Haskell is typically terse in addition to expressive. So "tight" seems more apt.

Lisp is traditionally not so terse, but still expressive.

Re: A couple million lines of Haskell: Production engineering at Mercury

#184
post #35
post #33

risky move, what is the talent pool for Haskell devs these days?

There are two countervailing effects when you choose a more theoretically advanced programming language. On the one hand, your hiring pool shrinks. On the other hand, the quality of the remaining hiring pool goes way up, which acts as an excellent recruiting filter (for both employer and employee). Jane Street made a similar play with OCaml.

The problem is that the intersection between your business's interests and the interests of the small pool of available developers is usually very small.

Building banking apps? Well, even if it's Haskell, the Haskellers were dreaming of GPU compiler jobs, not banking front ends. So you're probably down to literally 5 qualified people on earth who want your job.

But then 3 of those 5 don't want to relocate or have other operational desires that require you to re-think how you run your team, and 2 of those 5 believe so strongly in supply-demand that their salary should be 3x the industry average.

Many companies, including Jane Street, come to the same conclusion: If you really want developers of a niche language, you have to be very good at finding smart people who don't know the language and training them.

Re: A couple million lines of Haskell: Production engineering at Mercury

#185

Earlier quoted context omitted.

This is really a non-issue in practice. In the olden days, you’d just make the change and then spend a pleasant hour or two fixing the callsites by responding to compiler errors in a pretty low-thought, mechanistic way. Nowadays you can outsource that part to a coding agent and get on with your life. In any case, the fact that the compiler knows what code needs to be updated is a real superpower.

Well, it's still a suboptimal solution. Moreover, if you are modifying any library functions, there is a high probability that you can't change the call sites at all because you simply don't have access to them.

[deleted]

Re: A couple million lines of Haskell: Production engineering at Mercury

#186
post #59

Earlier quoted context omitted.

> I agree that this can be nice when done right (Clojure), I don't think Clojure has untagged union types like TypeScript or Scala. > but null is a high price to pay for this convenience. Why would it be? Untagged unions prevent null pointer errors just as much as option types do, only they don't have the discussed disadvantages of option types.

I was thinking about a general experience of working with null/nil. Clojure has nil punning which makes sense in the context of the language (lisp variant) and can be nice to work with. The null is a high price to pay because eventually someone will make some type assertion somewhere in the TS codebase that will end up biting you. Sure, you can be diligent, but will every contributor during the lifetime of a project…

> The null is a high price to pay because eventually someone will make some type assertion somewhere in the TS codebase that will end up biting you. Sure, you can be diligent, but will every contributor during the lifetime of a project be?

Type assertions and untagged union types are entirely independent. Supporting untagged unions doesn't imply supporting type assertions, and not supporting untagged unions doesn't imply not supporting type assertions.

> Not sure about Scala, but I did see NullPointerException every so often, and what is the practical advice to handle them in Scala? It’s to use Option[T]

Scala only supports untagged unions since version 3, so that's probably the reason why they are not used everywhere yet.

Re: A couple million lines of Haskell: Production engineering at Mercury

#187

I just wanted to leave a glowing comment about Mercury itself, since this is one of the few times I’ll be able to. I’ve been using Mercury for 5 years. In that time, I’ve been able to wire transfer money without having to worry it might disappear (functionally impossible at certain other banks), created hundreds of virtual debit cards each with their own limit and pulling from different accounts, created dozens of ac…

I badly want to try out Mercury, in fact I have an account already, but they don't yet support Zelle. I really hope their national bank charter application gets approved. (They applied for one last December.) Once they support Zelle, I'll drop U.S. Bank, as their app sucks and they don't have an API.

https://www.businesswire.com/news/home/20260427949683/en/Mer....

Re: A couple million lines of Haskell: Production engineering at Mercury

#188
post #151
post #7

> Haskell gives you tools to encode these incantations in types so they cannot be forgotten. This is, for my money, the single most valuable thing the language offers a production engineering organization. Haskell is admittedly, probably the most powerful widely (or even somewhat widely) used language for doing this, but this general pattern works really well in Rust and TypeScript too and is one of my very favorite…

This is more of a question of Affordances than type systems as per se e.g. you can do this quite happily in C# or something it's just that the amount of visual clutter is more than the actual type definition.

I think that's getting better in C# with record types (and primary constructors in general). Real Discriminated Unions should help a lot, and that's finally in Language Preview now.

Re: A couple million lines of Haskell: Production engineering at Mercury

#189
post #106
post #100

Earlier quoted context omitted.

What you cannot do is compile-time safety guarantees, and in languages like Rust type system isn't strong enough to do some advanced compile-time guarantees (via types). So no, you cannot do this in basically any language (unless you turn it into Haskell).

What the parents describe can be done with almost any language.

No you cannot

Re: A couple million lines of Haskell: Production engineering at Mercury

#190

Earlier quoted context omitted.

I badly want to try out Mercury, in fact I have an account already, but they don't yet support Zelle. I really hope their national bank charter application gets approved. (They applied for one last December.) Once they support Zelle, I'll drop U.S. Bank, as their app sucks and they don't have an API.

Ironically I dropped US Bank for Mercury too. You’ll be glad you did. You could try them out while still having your US Bank account.

Maybe once I can get a job again.
Post reply on HN