See a typo? Have a suggestion? Edit this page on Github
Both the Stackage and Stack projects originated many years ago. At the time they started, they had specific goals geared at solving problems at the time. Some of those problems remain, some have changed. Also, as the projects have continued, some goals have morphed as well.
I recently received some questions from newer members of the Haskell community who were uncertain of some design points in Stackage. As I’m wont to do, instead of giving a targeted answer to those questions, I’m going to take the opportunity to provide a more in depth review of the history of these projects, the philosophy governing how they work, and some (highly opinionated) thoughts on what the future may hold for them.
To start off with, let’s give some historical links. I’ve typically been pretty vocal about what I’m working on, so there are quite a few posts available. I’m also assuming people aren’t going to go through and read all these posts, so I’ll be covering a simplified view of the history next.
There are also a bunch more on the FP Complete blog, but I decided this was probably enough for the moment. Finally, I’d like to include a write-up by Matt Parsons on the Stack timeline. His write-up provides a far more concise summary than mine, with dates to boot. What I’ll describe below talks far more to the motivations for each decision.
I am going to state as plainly as I can the goals I have always had for these two projects. I know many people out there have attributed ulterior and sometimes nefarious motives to me. To those who question my sincerity: you may as well stop reading this blog post now. For people willing to take me at my word, here’s the goal:
Increase the adoption of Haskell.
I work for FP Complete, and our goal is slightly different:
Increase the commercial adoption of Haskell.
That’s really it. I haven’t always made the best decisions towards this end. In 20-20 hindsight, there are certainly other ways I would have approached things, especially on how I would have presented the language to non-Haskellers. But that’s the goal.
You may say, “Well, obviously that’s the goal.” But that’s not true. There are many different goals that may exist. “Design the most elegant solution to problem X,” or “Generate a bunch of research papers,” or “Convince one really wealthy company to pay me a lot of money to work on Haskell.” I’m not saying those are other people’s goals, or that they are somehow other goals of mine. I’m pointing out that the goal I had was simple to state, explains many of my decisions, and is in fact opinionated.
One final note: I’m willing to make trade-offs to achieve that goal, to an extent. I’m willing to giving up on some level of elegance in the solution to solve an immediate problem. I know others disagree with me on this. That’s a fair thing to disagree on, but it also explains why differing solutions have arisen.
The origins of this start in a simple place. I wrote Yesod. For better or worse, I designed Yesod as a large collection of packages to allow people to mix-and-match components (e.g., use Warp the webserver or Shakespeare the templating engine without Yesod itself). For years, I received many, many complaints from users about how difficult it was to build Yesod.
I tried following the Package Versioning Policy (PVP), but at the time, this actually made the problem worse, not better. It’s really not worth debating this point, though some will want to. This is absolutely what I thought at the time, and why I stopped following the PVP. I believe this was due to limitations in the dependency solver at the time. Regardless of whether those problems have now been fixed, or whether I just had a fundamental misunderstanding at the time, I became convinced that a versioning policy was insufficient to escape dependency hell.
The Haskell Platform solved some level of the dependency hell issue, by providing a predetermined set of package versions that were known to work well together. However, it wasn’t nearly enough to solve my problems, since it only covered a relatively small number of packages. (This was by design, and it was the right design for HP.) To work around this, and finally stop losing prospective users, I put together the Yesod Platform: a collection of package versions known to work together. This helped.
When I started working for FP Complete, we ran into similar dependency issues, as did our customers. Yesod Platform was the right idea, but it only covered Yesod. What about people working with completely different libraries, or using a different web framework? We cobbled together some internal tooling for coming up with package sets.
Eventually, I realized that the entire community would be able to take advantage of this. We created the Stackage project, started publishing snapshots, and folded Yesod Platform into it.
Much of the community viewed Stackage as a “community wide CI,” in the sense that it gave feedback to maintainers for when their builds failed. I thought there was much more potential to Stackage. I believed it could dramatically increase usability of Haskell for new users. After all, out of the gate, most Haskellers were still regularly hitting dependency issues.
The history of Stackage continues on from here, including adding a curator team, formalizing our processes, figuring out how to make tricky decisions around when to boot out packages, and so on. However, we’re going to skip all of that history as it’s less interesting for now, and continue chronologically with the inception of Stack.
Let me start by saying that many of the problems of cabal I’m about to
allude to have been addressed, either with improvements to the
standard workflow, the addition of sandboxes, or the
system. However, I’m addressing the history here.
At the point our history is continuing from,
addressed some of the more serious dependency solver issues from the
past. However, dependency solving was still unreliable. You could
certainly make the claim that I was part of the problem by not
following the PVP. However, it’s also irrelevant:
the design of the dependency solver till today means once you have one
piece of bad historical data, the solver cannot be guaranteed to work
correctly. I strongly believe that no matter what you do, people will
make mistakes, so trusting PVP-guided dependency solving wasn’t going
to be a solution for me.
The Hackage Trustees introduced the concept of Hackage metadata
revisions at the same time. I did at the time, and still today,
strongly oppose this decision. It has made tooling much more complex,
and introduced new layers of trust into our system. Using this wasn’t
an option when Stack first came onto the scene, since the system was
not fully developed (e.g., the
01-index.tar.gz archive didn’t exist
yet). There were many alternative solutions if PVP-guided dependency
solving was a goal (like ignoring previous patch releases), but we
ended up with metadata revisions instead.
Anyway, back to the history. The out-of-the-box
experience involved a lot of user frustration. At FP Complete, we
ended up writing a number of scripts around
cabal-install usage to
ensure our software could be developed and deployed reliably. We heard
the same kind of story from many other Haskell shops we spoke with. We
cabal-install was a pattern repeating across the
My next goal was a simple one. Combining Stackage and cabal sandboxes, the user experience was fairly decent, with mostly reproducible build plans (ignoring the incoming metadata revisions). I tried to work with the Hackage, Cabal, and Haskell Platform teams to get Stackage included in the system. Ultimately, this resulted in a plan called GPS Haskell, devised in person at ICFP 2014. I made some changes to Stackage to accomodate (removing the local patching we did to work around restrictive upper bounds). However, there was no further response from the other teams, so I had to consider this a dead end.
At FP Complete, we were working on an FDA regulated medical device
written in Haskell. There were dozens of people working on this, many
of whom were not Haskell engineers by trade. We needed to make
guarantees to the FDA that the build plan was reproducible. For the OS
level, we used Docker. But at the Haskell layer, we needed to do
something based on Stackage. We could have done this with
cabal-install, but we needed something that worked reliably across
three OSes, was easy enough for non-Haskellers to use, including QA
engineers and auditors within the client company. We were looking at
writing yet another set of wrapper scripts around
This is the environment in which Stack was born. We’d already written
these scripts multiple times. We already knew how unreliable it was to
try and wrap around
cabal-install like this. We were already
reinventing a bunch of the logic inside
cabal-install. The presence
of the dependency solver was—for our purposes—a bug, not a
feature. We had requirements for automatic Docker support.
We discussed with our customer, and made the decision that it was time
to invest in a new tool. I promise you that this decision was not
taken lightly. For internal usage, we realized we didn’t have much
choice. Releasing it as a competitor to
cabal-install was another
matter. But it came back to the “promote (commercial) adoption of
Haskell.” We had lots of anecdotal evidence to suggest that a new
build tool would help that case.
So we released Stack. It was a calculated trade-off between the downsides of forking part of the ecosystem versus providing a better user experience and hopefully encouraging Haskell adoption. Was it the right decision? I still believe so. I know others do not.
I’ll leave one last note in the history section, which has been a
recurring theme. No one has the ability or right to force anyone to do
anything they don’t want. I could not force the
to add Stackage support. I made that request, and nothing came of
it. That’s their prerogative. However, in an open source world, if you
don’t listen to the requests of users, the only responses they have
are to give up on the features they want, or to fork. We elected to go
the latter route with a new tool, because the benefit of having a new
tool that did what we wanted outweighed the costs involved, at least
in our judgement.
Alright, that’s the history. And the goal of all of this is hopefully clear. Over the years of building, maintaining, and modifying these projects, the philosophy driving them has evolved and solidified. As one person involved in these projects, let me describe the underlying philosophy I see.
stack.yamlfile, and there is a separate set of commands (
solver, etc) involved in modifying that file. Changes to your
package.yamlfile have no impact on the set of packages available.
One thing we’ve already been doing in the Stack code base is decoupling extra functionality. We’ve split off a few libraries already. I’ve spent some time working on Pantry as a means to separate out the package source logic from Stack. I’d like to see that trend continue. Another idea is separating out the GHC installation logic so it can be used separately. In my ideal world, “how you install the tools” would be orthogonal to “which tools you use.” It’s part of why I ultimately opposed to the original Haskell Platform (now HP Full): it bundled opinionated concepts about which libraries you should use with the less opinionated installer for GHC.
stackage-curator tool. This follows directly from the
Pantry work, and will hopefully allow a few improvements:
For security sensitive use cases (like the FDA regulated medical device I mentioned above), including more secure source information is vital. Currently, Stack relies upon the package tarball hashes from Hackage Security. This introduces a layer of trust that those hashes are not modified or corrupted over time, which is hard to justify in highly-security-sensitive setups. The upcoming Pantry-based Stack will include far more hashing information so that you can demonstrate provenance of the source files exclusively from what’s in your source tree. I want to see further improvements to the security story like this.
As you may have noticed, I’ve talked a lot about community processes over the past year or so. I find the area fascinating and underexplored. I’m already trying to take a back seat in the code writing aspect of these projects, and involve myself more in organization and support. The Stackage Curator team has worked out really well, and the much newer Stack Issue Triagers initiative seems to be working out nicely as well.
As a final point, let me address this question, which comes up a lot. Despite what many people claim, neither FP Complete nor I have any vested interest—or even desire—to maintain a separate build tool (Stack). Stackage is a project I started because I saw a gap in the ecosystem. But my preference had always been to have Stackage become part of the rest of the tooling, not have a separate set of tooling.
At this point, many people and companies rely on the Stack tooling and
cabal-install has certainly made improvements in the past
5 years, but it is still different. It has different goals, a
different UX, and supports different features. There is not a 1-to-1
mapping between the functionality.
I’d love to see the gap close. I’d still love to see support for
Stackage snapshots added to
cabal-install. I think Stack has done some
great work with things like the script interpreter, the approach we
have to the implicit global project, the reproducible-by-default build
plans, and the security we’re introducing with Pantry.
In my ideal world, and I mean this with complete sincerity, enough of
these features would move into
cabal-install that we could declare
Stack no longer needed. While forking isn’t inherently evil, if it can
be avoided it would be a good thing. I don’t think the current plans
cabal-install take it in the direction I’d like to see, so this
is unlikely to happen. But I say in all good faith: if enough of the
Stack community’s needs and desires could be met with
I’d advocate for a some kind of deprecation cycle for Stack.