Haskell: built by committee as a research base, its ideas reached C# and Hack, yet its last formal standard dates from 2010

Haskell · 1987: Researchers created Haskell in 1987 as a shared standard.

At FPCA '87 in Portland, Oregon, researchers in functional programming sat down and counted the languages they had between them. The tally passed a dozen. Every one was non-strict and purely functional, and each came from a different group with its own syntax and its own ideas. Interest in such lazy languages had been growing since 1985, when Research Software Ltd. released Miranda.

Miranda was the most widely used of the lot, and it belonged to a company. For a community that wanted a common footing for its work, that fact stung. The room did not argue long. It reached a strong consensus that a committee should define an open standard for lazy functional languages, one that no single firm could own.

The committee's job sounded simple on paper: gather the existing functional languages into one common language, to serve as a basis for future research in functional-language design. Yet the underdog odds were plain. A group of researchers, with no company behind it, no budget in the facts and no customers, was proposing to outdo a product people already used. Could such a committee build a language that outlasted its own members? The first answer would come from the materials it chose, because the committee had no intention of building everything from scratch. What would it build from?

Photograph: Simon Peyton Jones
Photograph: Simon Peyton Jones. Photo: Duncan.Hull. Wikimedia Commons · CC BY-SA 4.0. Resized and converted to WebP; no retouching.

A committee that borrows instead of inventing

The committee started by picking a place to stand. It took Miranda's semantics as its base, and that choice gave the working group a single body of ideas to push on instead of a dozen rival ones. The rule for everything else was simple: wherever an off-the-shelf solution existed, gather it up and use it.

The plan had an awkward edge. Miranda belonged to a company, so the committee could borrow its semantics but never its product, and a dozen competing designs still crowded the same ground. Whatever the committee built had to be something that no single owner could close off.

The name came first, and the committee chose to honor a logician: Haskell Curry. The description of the language followed. It would be general-purpose and statically typed, with type inference and lazy evaluation, and it would be purely functional. That last word carried a promise. Functions would generally have no side effects, and anything that touched the outside world would need a distinct construct of its own.

Then came the choice that answered the Portland room. The committee published its specification openly and welcomed more than one implementation of it. Anyone could now read the rules and build a compiler, with no license to buy.

Builders soon arrived. One early implementation, HBC, supported Haskell 1.4. Lennart Augustsson wrote it, and it rested on Lazy ML, an earlier language the committee's own borrowing habit had already drawn on.

Borrowing had a limit, though. Overloading still had no clean answer: how one operator, like plus or equality, could mean different things for different kinds of values. The committee was about to meet that problem head-on.

Wadler and Blott solve the equality problem

Philip Wadler and Stephen Blott brought the committee a proposal for the problem it could not solve. Their idea was type classes, first put forward to end the ad hoc handling of equality types and arithmetic overloading. Until then, each language patched those corners in its own way, and the patches did not agree.

The decision was not easy. The committee was building a language from off-the-shelf parts, and type classes were new and unproven. Adopting them meant betting a shared standard on an idea no other language had tested. Rejecting them meant carrying the old patches forward. The committee chose the bet.

The bet landed inside a strong, static type system built on Hindley–Milner inference, the method that lets a compiler work out types on its own. Type classes slid into that machinery and gave overloading a principled footing. Haskell became the language that pioneered them for type-safe operator overloading. They became its principal innovation in typing. What began as a tidy way to add overloading was soon used far more widely than anyone had planned.

Others picked the idea up and pushed it. Mark Jones built Gofer, an educational dialect of Haskell, and gave it constructor classes. Hugs later supplanted Gofer, but the extension showed that the new idea had room to grow.

Growth had a cost for newcomers, though. Helium, another tool for learners, disables type classes by default so that its error messages come out clearer.

One promise remained shaky. Haskell was supposed to be pure, with no side effects, yet programs had to read keys and write files. Input and output were about to test that promise.

Version 1.3 retires the streams

The committee could not wave away the input/output problem, and purity made it worse. Through version 1.2, programs reached the outside world by way of streams and continuations, two mechanisms that most people found unsatisfactory. A language that promised no side effects had a hole in its hull, and every program that read a key or wrote a file sailed through it.

Version 1.3 was the repair. The committee brought in monadic IO and, in the same release, generalised type classes so they could range over type constructors, the types that take other types as parameters. The second change made the first possible. Classes that had been limited to plain types could now describe whole families of them.

Then came the part programmers could feel at the keyboard. Do notation let them write effectful steps one after another in a plain, readable sequence, and the monad underneath kept referential transparency intact. Haskell now had an effect system that stayed faithful to purity and was pleasant to use.

The same release made a smaller, quieter choice. The committee took seq out of a type class and made it a standard function, so that programmers could refactor their code without the class machinery getting in the way. The operation itself carried a certain irony. Seq creates a data dependency between values, and lazy languages use it to keep memory consumption from running away. A language built on laziness had to ship a brake against its own appetite.

The monad turned out to be bigger than the problem that had summoned it. The construct that handled side effects could also model error handling, nondeterminism, parsing and software transactional memory.

That success carried its own warning. Programmers who build on a language need it to hold still, and this one had changed with nearly every release. Could the committee, which had spent its energy adding, now find the nerve to stop?

Late 1997: the committee freezes Haskell 98

A member of the committee asked the question aloud, whether to keep going or stop, and the group answered it with a full stop. Release after release, the numbered versions of the language had each moved the ground under anyone who built on it, and nobody wanted to be the one to cut another. In late 1997 the members chose to end the series with Haskell 98.

They had a clear job for it. Haskell 98 would be stable, minimal and portable, a version that teachers could put in front of a classroom and that implementers could take as a base for their own work. The committee wanted a language that would stay put long enough for a textbook to be printed.

The researchers in the group wanted the opposite. Many of them had joined to try out experimental features, and a frozen report looked like a locked door. The committee settled it by splitting the job. The report would hold still, and the members expressly welcomed extensions and variants of Haskell 98 that carried experimental features.

The paperwork took a while. The Haskell 98 Report was originally published in February 1999, more than a year after the committee's decision. A revised report followed in January 2003, a tidy-up of a document that was meant to stay fixed.

Meanwhile the open door did what open doors do. Experimental features gathered around the stable core, and one compiler, GHC, carried most of them. It came to be described as the de facto standard of the evolving language, which meant that the working definition of Haskell was drifting from the report on the shelf to the program on people's machines.

How long could a standard stay small while the extensions around it kept growing?

Haskell 2010 deletes a pattern that lied

Another revision was due, and the committee sat down to it once more. The effort went by the name Haskell Prime, and for years its members worked without a date to point to. Then one came: in November 2009 they announced Haskell 2010, and the following July they published it.

The members had a pattern to throw out. An n+k pattern let a programmer write a definition that matched a number and peeled off a constant, and on the page it looked as if it used (+). The compiler did something else. It desugared the pattern into code built on (-) and (>=). A line that seemed to add was subtracting and comparing underneath, and the committee decided that syntax should not say one thing while the machine did another. The pattern came out.

Other changes went in. Module names could now be hierarchical, so a programmer could write Data.List where the old report had allowed only List. The report also specified a foreign function interface, a way for Haskell code to call code written in another language, though only C bindings were specified. And the committee loosened the type inference rules, so more programs passed the type checker.

One addition said more than the rest. By 2010, dozens of extensions were in wide use, and many programs began with a request for some feature the report had never described. The committee gave that habit a formal home by specifying the LANGUAGE pragma, the line at the top of a file that switches an extension on.

The Haskell 2020 spec that never arrived

On a late April day in 2016, Herbert Valerio Riedel announced the Haskell Language 2020 Committee. The promise the old committee had made in Portland now had a new group behind it. Riedel laid out who sat at the table: 20 members, chosen to speak for practitioners, implementers, educators and researchers. The people who wrote Haskell code, built compilers, taught students and ran experiments all had a seat.

Riedel's announcement came with a schedule. GHC 8.8, likely due in early 2020, would be the first release to comply with Haskell 2020. A name, a compiler version and a year made the plan sound close at hand.

The announcement also said how the work would run. The Haskell Prime Process relied on everyone in the community contributing proposals, so the committee would not write the standard alone. It would wait for proposals to arrive and then judge them.

The members drew a boundary around the job. They chose to focus on the language itself and to leave the libraries to the Core Libraries Committee. A standard that covered only the language was a smaller thing to finish, and still the finish never came.

The planned year slipped past, and a programmer who went looking for the Haskell 2020 report found nothing to open. When something new finally arrived in late October, it shipped inside GHC 9.2.1 under the name GHC2021, and it was not a formal specification. Nobody had published a document that any compiler could be measured against.

The formal standard had stalled, but the ideas had never waited for it. Where had they gone?

From Meijer's lectures to Hack and Pugs

In 2009, Erik Meijer sat down in front of a Channel 9 camera to teach functional programming, and he taught it in Haskell. He chose the language because it is pure, and he treated the specific language as a detail of little weight. The man behind the lectures already had a record: Channel 9 credited him with many functional constructs in C# and VB.NET, LINQ among them. Ideas that the committee had defended inside a lazy research language were turning up in the everyday tools of working programmers.

Other languages borrowed in their own ways. InfoWorld listed Haskell among the influences on CoffeeScript, next to Python, Ruby and YAML. Then came Facebook's Hack, built by Bryan O'Sullivan, Julien Verlaguet and Alok Menghrajani and announced on March 20, 2014. Users who tried to name the nearest relative of Hack pointed to Haskell, a statically typed language, though Hack goes further. It brought gradual typing, until then mostly an academic exercise, to an industrial-strength language.

The most playful descendant came from Audrey Tang. Her Pugs was the first substantially complete implementation of Perl 6, with a native runtime written in Haskell, and she ran it under a policy she called -Ofun, which put fun above speed of execution or merchantability. In Portland, a room of researchers had looked at Miranda, a language owned by a company, and asked for one that nobody owned. Now that open language powered a project whose only rule was fun.

Editorial graphic and headline text by Signal Titans.

Source: Simon Peyton Jones and the 1990 Haskell: How a Committee’s ‘Lazy’ Bet Created a Pure Functional Language · Haskell (Wikipedia) · Computer Science · ANN: Haskell Prime 2020 committee has formed · C9 Lectures: Dr. Erik Meijer – Functional Programming Fundamentals, Chapter 1 of 13 | Going Deep | Channel 9 · Turn up your nose at Dart and smell the CoffeeScript | InfoWorld · Facebook Introduces 'Hack,' the Programming Language of the Future | WIRED · Functional Programming HOWTO — Python 3.15.2 documentation · Glossary of Terms and Jargon / Perl 6 · GitHub – erkmos/haskell-companies: A gently curated list of companies using Haskell in industry · GitHub

Share this article
FacebookThreadsLinkedInX

Leave a Reply

Your email address will not be published. Required fields are marked *