Skip to content

Instantly share code, notes, and snippets.

@mietek
Last active August 29, 2015 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mietek/634b078bfdc710ac9174 to your computer and use it in GitHub Desktop.
Save mietek/634b078bfdc710ac9174 to your computer and use it in GitHub Desktop.
Partial transcript of “I Don’t Get Functional Programming”

The Bike Shed

Partial transcript (35:10–39:10)

Derek Prior: “How is that ecosystem? I know when we first deployed things, it wasn’t going particularly well.”

Pat Brisbin: “Although the deployment was difficult, the ecosystem’s great. There’s, like I said, thousands of libraries to do anything that you need.”

Derek: “But specifically, the tooling? How’s the package manager, how’s deployment, how’s… I don’t know, anything else you have to deal with?”

Pat: “Cabal is notorious for not… being good.”

(laughs)

Derek: “Sorry, Cabal.”

Pat: “Sorry, Cabal. The problem is, there is this huge pool of libraries on Hackage, which is the Haskell package repository, and they are able to exist at any number of versions — every library on Hackage could have tens, hundreds of versions that have been released, and your package has its own version bounds, and… Dependency resolution is not an easy problem — no matter what npm says, it’s not solved!”

(laughs)

Derek: “We got an npm dig in this episode. Good! I think we’re 10 for 10.”

Pat: “And so, a lot of times Cabal has trouble, and that’s probably the number one most off-putting thing for new Haskell users — they run into that, throw up their hands, and run away. But there have been improvements: Sandboxes are good; it’s like Bundler for Cabal — it lets you have an isolated project directory, so that your projects don’t conflict with each other in their dependencies, which is a huge win. You can do freezing now, which is like Gemfile.lock, so you can be sure that if it works on my machine, you can then install the same exact packages, and it works on your machine. Hopefully. Deployment — we had some trouble deploying to Heroku.”

Derek: “Right. That’s going to be harder, right? The environment’s limited there.”

Pat: “Yeah. It was mostly the build timeout, just because Haskell’s compiled, and dependencies are very isolated, so there’s a lot of them. So, a large project is going to have to compile a lot of dependencies. We just kept hitting the build limit, but recently, we found a tool called Halcyon, by developer Mietek Bak. He’s written this thing as a proof of concept for fixes that could be made directly in Cabal — to make it better for these use cases; to try and reduce having to compile things a lot of times. Ideally, you shouldn’t have to compile the same dependency a bunch of times.”

Derek: “You wrote an article about this on the blog, right? We’ll link to that in the show notes. It’s pretty good. It’s okay.”

(laughs)

Derek: “It explains how you cache the results of your build on S3, right? And then another developer can just come along and get those, without having to compile them themselves, which turns out to be way faster.”

Pat: “Exactly, yeah. As long as you’re on the same platform — two people on the same platform shouldn’t have to compile the same project.”

Derek: “There were some caveats to that, right? It builds into /app, so you only have one project that you’re working on at a time, before you blow it away, and then have to… How’s that?”

Pat: “Yeah. So, the sandboxes which I mentioned earlier are isolated package databases, so your projects don’t conflict with each other. And the way that it works is, it builds these sandboxes, and then it caches that on S3. So, instead of building your own sandbox, you just grab the one from S3. Now the problem is that sandboxes hard-code the path that they were built in within themselves. So, if you built it in /home/derek/projects, and I built it in /home/patrick/projects, we couldn’t share it. So, by default, it puts it in /app/sandbox. You can work on multiple projects at a time, but you have to rebuild /app/sandbox when switching.”

Derek: “Rebuild? Just re-download the sandbox?”

Pat: “It may not even re-download, because it’ll cache it locally, so it might just be extracting a tar file. So it’s not slow to switch projects.”

Derek: “I think I remember when reading that thing I thought it was a little weird, but it actually seems reasonable. The ultimate solution would be to have it not encode full paths.”

Pat: “There’s an open issue to get that fixed, but development is slower than I would like on Cabal.”

Derek: “All right. Well, get involved!”

(laughs)

Pat: “That’s a good point.”


For more information on Carnival, Halcyon, and Haskell on Heroku, see “Ship You a Haskell” and “Building Haskell Projects with Halcyon” on the thoughtbot blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment