Category Archives: Technical

Cabal Package Installation Woes

tl;dr: Nuke ~/.ghc and then run cabal install --lib (every lib you need)

Edit: Since writing this post, there’s been some movement on the cabal bug, and it seems like there’s soon going to be a fix!

I’m trying to write a simple webserver based on Warp, but I ran into an issue with a hidden package. Here’s my imports in Server.hs:

{-# LANGUAGE OverloadedStrings #-}
import Network.Wai (Application, Response, rawPathInfo, responseFile, responseLBS)
import Network.HTTP.Types (status200, status404)
import Network.Wai.Handler.Warp (run)

And here’s the relevant part of my .cabal file:

executable server
  main-is: Server.hs
    base >=4.12 && <4.13
    , wai
    , warp
  default-language:    Haskell2010

Note that http-types is missing, but we’ll come back to that at the end.

I’ll start by saying that I don’t fully understand the difference between cabal and stack, and at the beginning I decided to just use cabal and not worry about stack.

I ran cabal install wai warp and got the following error:

Resolving dependencies...
cabal: Cannot build the executables in the package wai because it does not
contain any executables. Check the .cabal file for the package and make sure
that it properly declares the components that you expect.
Cannot build the executables in the package warp because it does not contain
any executables. Check the .cabal file for the package and make sure that it
properly declares the components that you expect.

It turns out the solution to this is to append --lib and run cabal install --lib wai warp. (I wish it would say that in the warning though.)

I ran cabal install wai warp --lib and tried running Server.hs by pressing command+b in Sublime Text 3, but I ran into this error:

Could not load module ‘Network.HTTP.Types’
    It is a member of the hidden package ‘http-types-0.12.3’.
    You can run ‘:set -package http-types’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v to see a list of the files searched for.

I think what’s happening here is that http-types is installed, but not explicitly. Haskell wants me to definitely say that I want it, so I try running cabal install --lib http-types.

This, however, runs into a very frustrating error. Apparently the process library is required at two different versions in two different packages – despite already being happily installed as an indirect dependency:

cabal: Could not resolve dependencies:
[__0] trying: base- (user goal)
[__1] trying: ghc-8.6.5/installed-8.6... (user goal)
[__2] next goal: process (user goal)
[__2] rejecting: process-, process-, process- (constraint
from user target requires ==
[__2] rejecting: process- (conflict: ghc =>
[__2] rejecting: process-, process-,
process-, process-, process-,
process-, process-, process-, process-,
process-, process-, process-, process-,
process-, process-, process-, process-,
process-, process-, process-, process-,
process-, process-, process-, process-,
process-, process-, process- (constraint from user target
requires ==
[__2] fail (backjumping, conflict set: ghc, process)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: process, base, ghc

The solution to this is very frustrating, because even rolling back my git repo to the last known good commit didn’t fix it – it’s a global system problem (ironic, for Haskell, which is so demanding of “pureness” in the language). I deleted ~/.ghc and ran the install again:

rm -rf ~/.ghc && cabal install --lib wai warp http-types

And it worked! My server runs 🙂

The problem is now, I want to build some tests, so I run cabal install --lib hspec and I run into the same “could not resolve dependencies” as above!

Hm, let’s see if just a rm -rf ~/.ghc && cabal install will fix it, if I declare hspec in build-depends in my .cabal file? I get the following error:

cabal: Path '/Users/erty/.cabal/bin/server' already exists. Use
--overwrite-policy=always to overwrite.

So let’s try the suggestion and run --overwrite-policy=always. Infuriatingly, this build succeeds but when I try to actually run Server.hs (by pressing cmd+b in Sublime Text, perhaps that’s missing a flag or something? I wonder if cabal install builds a binary but fails to install the libraries) it fails to find any of my modules:

Could not find module ‘Network.Wai’
Could not find module ‘Network.HTTP.Types’
Could not find module ‘Network.Wai.Handler.Warp’

Let’s try rm -rf ~/.ghc && cabal install --lib, since adding --lib worked before. First, I also added http-types to my build-depends in the .cabal file. Nope:

Resolving dependencies...
cabal: Cannot build the libraries in the package crossword-hs because it does
not contain any libraries. Check the .cabal file for the package and make sure
that it properly declares the components that you expect.

But! We were able to get it working by listing all of the dependencies explicitly during the install phase. So let’s try that and run rm -rf ~/.ghc && cabal install --lib wai warp http-types hspec:

Works! The problem is that I have to remove ~/.ghc manually list out all of my deps every time I want to install something, but at least I can move forward for now.

I also added http-types to my cabal file, but it didn’t seem to really matter for running in sublime text, as long as I’d installed it via cabal install --lib.

I would love to hear from any more experienced haskellers out there if I’m not understanding something about cabal. Specifically, coming from node, I feel like cabal install (or even with --lib should “just work” and install all of the deps I’ve listed in the .cabal file.

Hopefully this writeup saves someone else time 🙂

Radish Cache

After coming across a (now deleted) answer on StackOverflow, I took some time to find instances of “redis” (a popular caching program) misspelled as “radish”. I think autocorrect is likely the culprit.

I’m posting these here because I think that this is a wonderfully innocent error and not to shame the people involved. Imagining someone refreshing their cache of small red vegetables brings joy to my heart and I hope it does to yours as well.

The Original

This came up in an edit queue, but I didn’t have the heart to edit it. I now suggest this as the solution to most of our technical problems at work, much to my coworkers annoyance.

From Harvard

This one is in an article published by Harvard, so you know it’s legit.


This person has radish cache on their LinkedIn profile, so you know they’re an expert. (Last item)

Please go to my LinkedIn and recommend me for radish cache. I’d like to add you to my persimmon network.

Speeding up Magneto

Vegetables are part of a healthy diet. Varnish, not so much.


Unfortunately, the only IRL radish cache has been removed and no longer exists.


Remember, if you have a problem, flush your radish cache!

a e s t h e t i c 💫 g e n e r a t o r

Update: the a e s t h e t i c g e n e r a t o r is now online.


Ryan McVerry, Per-Andre Stromhaug, and I got together this weekend to do a mini-hackathon. We’d been inspired by a Chicago-based artist on Tumblr named Galactic Castle. Specifically, this image:

Our goal, was to write python to generate images that looked like Galactic Castle’s. We used the Pillow python library for the most part, messing around with 256×256 arrays of integers, limited to 10 or so colors.

We experimented with a few different rendering techniques, eventually settling on a layered technique. I’ll start with some examples of the finished product, and then a quick walk through some of the fun images we generated along the way. You can run it yourself at

Here are a few shots from the process along the way.

This is one of the first renders we saved. You can see most of the elements coming together, and the dithering in the sky is already in place.

Experimenting with color palettes:

I messed up the color palette:

Getting reflections working. At this point I was doing two things that I eventually stopped doing: reflecting the actual colors (instead, we just use a single color to represent any reflection) and at this point we weren’t doing any sort of layering, so the reflections were crude and unaware of what they were reflecting. In the latest version we use a different algorithm for things above the horizon (mountains, moon) and things in the water (rocks/land).

Better reflections, added a moon.

Re-worked the rocks code. We were originally using polygons that were then filled by PIL. The new code instead generates an enormous int buffer and we manually fill in from the edge. The rocks at the base of the land spits are just handled by keeping track of a number that grows and shrinks, and switching colors when we reach that threshold.

We were originally working at 512×512 (scaling up x4 for the final image), but eventually realized that Galactic Castle works at about 150×150, so we scaled down. The resulting pixelation is much more pleasing. Added trees and improved the mountain cross-hatching.

I hope you enjoy this! You can see it for yourself at

In 2024, I rewrote it in Typescript so that it runs fully in the browser (instead of a thin frontend on a Python backend). Code here 🙂

We Built an Arcade Cabinet in a Weekend!

We built an arcade cabinet! In 72 hours!

The team:

Project Lead
Software Engineers
Hardware Engineer
Music and Sound
Cabinet Construction
Cabinet Art

Finished image first 🙂

We had the idea to build an arcade cabinet several months ago, and by the time Ludum Dare 38 rolled around, we had the time and space to make it happen! We met a few times beforehand to test out ideas and hardware, and parts started arriving in early April:

We decided to use the LÖVE framework on Raspberry Pi 2-Bs, via the PiLove raspbian image.

Ideas started flying on Friday at 7pm Mountain, though, when we all got together to create the game. Sadly, our game idea about slipper and flipper the penguins didn’t make it to the final round.

We quickly began to mock out the cabinet design, and started building the game!

Our first prototypes were… okay 🙂

But things began to come together…

The cabinet really began to come together! We thrifted the TV for about $30. The speakers were old computer speakers we had lying around, and the coin door we purchased on Amazon for about $40.

More construction pics:

Haley (our artist) couldn’t join us until day 3, but she did an amazing job!

The yellow paint was a little… weird. Ah well :\

Finally, we had the whole thing rigged up! Time to plug everything in and turn it on!

A few touchups on the title…

And, about 15 minutes before the deadline, we had a functioning, working arcade game!

Here’s a quick video of the gameplay:



We ran into a major issue right at the end, where (to get technical for a moment), our audio would cut out from time to time and just stop working. It seemed like an issue with pulseaudio. The way we solved it was to kill pulseaudio on startup. And for some reason that worked? So, I have no idea what’s playing the sound, but whatever it is crashes less.

We also had a wonderful “blur” effect that pulsed in time with the music, but it turned out to be too intensive for the raspberry pi, so we had to turn it off in the end. We tried doing it with shaders (way too intensive) and we tried doing it with just drawing translucent, larger versions of everything (just a little too intensive) and finally turned it off. Ludum Dare definitely requires you to just cut things if they’re not going to work, no matter how much time you put into them!

I’m going to attempt to get a copy of the game working so you can play it online by Friday, but no promises!

Dictionaries and Word Lists for Programmers

I love to play with words, and I especially love to play with words programatically. I’ve written three small apps (so far) which use some form of a dictionary to create readable, humorous text:

I’ve had some people ask, so here are some great resources that I’ve found while building these apps.


/usr/share/dict/words (~235k words)
Available on any *nix system, this word list is a local way to check for words using a simple grep. You can also read the file in as long as you have permission to do so. Won’t work well if you’re trying to write something for the internet or windows.
Most of these dictionaries are licensed very freely, but you should check on your own system. Versions of this are available online, e.g. the FreeBSD version at (click “words”)

GCIDE (~185k words) or
This dictionary contains words and definitions. Very useful if you actually want to look up the words you are using. Sources for the definitions are available as well. There are two versions – GCIDE which comes in a strange format and needs its own reader software, and GCIDE-XML. Licensed under GNU.

SCOWL and friends (variable word count)
A very complete set of wordlists, used for the aspell spell checker. My favorite part is the customizable interface where you can create your own custom dictionary. Many links and different dictionaries are available on this page, including some with part-of-speech and/or inflection data. Be aware: many versions of SCOWL contain swears and racial slurs.
Variable licensure, but all are released for private or commercial use as long as you maintain a version of the license.

CMU Pronouncing Dictionary (~134k words)
Contains not only words but their phonemes, meaning this is a great dictionary for text-to-speech, rhyming, and syllable counting. There are CMUDict libraries for node/browser, just node, python, and many other languages (send links please).
The file is copyright Carnegie Mellon, but is unrestricted for personal or commercial use.

Corpora (Lists of ~1k words)
A really neat set of lists, broken down by category (e.g. /data/foods/beer_styles.json). A great starting resource for small projects that don’t need an extensive dictionary of the English language. Licensed under CC0 (no copyright).

Wordnik Developer (Web API)
A powerful web API. From the site: “request definitions, example sentences, spelling suggestions, related words like synonyms and antonyms, phrases containing a given word, word autocompletion, random words, words of the day, and much more.”
Free 15k calls per hour, licensed for anything that isn’t a direct clone of Wordnik itself.

(Please, send any more dictionaries you know of my way and I’ll add them to the list!)


FastTag / jsPos (java) and (js)
Java and Javascript libraries to tag parts of speech in words. Very handy if you’re doing any sort of lexical generation.
Licensed under LGPL3 or Apache 2 licenses

(Please, send more libraries my way if you know of them!)

People / Blogs

Peter Norvig
Probably my greatest source of inspiration on this front is Peter Norvig’s How to Write a Spelling Corrector (python). He shows that you don’t need any sort of fancy tooling or arcane knowledge to write something that at first seems complex – just don’t be afraid of making the computer do a lot of work for you. That’s what they do – they do work really, really fast. (see, for example, this scrabble solver)

Allison Parrish
Allison plays with words in amazing ways. She is the brains behind @everyword. Her website and research are full of great inspiration for playing with words and experimenting with language.

(please, send anyone doing interesting things with words my way and I’ll add them to the list!)

Project Idea: “Lanky” PHP Middleware Language

I keep not writing weekend web apps because I know that my projects generally follow this trajectory:
1. Build a database
2. Build some thin PHP middleware to expose an API to that database
3. Build a slick react/angular/whatever frontend
4. Realize a bunch of things I’m missing in my API and add them, lamenting the entire time that my “thin” PHP middleware is starting to bulge at the seams.

I keep realizing that that PHP layer is not really necessary. R0ml gave a great Recurse Center talk (if someone has notes I’ll link it)  on a postgres extension which renders the middleware unnecessary.

I’m not quite ready to make that leap and throw out the middleware entirely (even though I think it’s a great idea…). So I’d like to build a language to really easily describe a PHP API. My goal is to have the PHP routing be as thin as possible and mostly handled by one fast function. In fact, I’d love to eventually have this language implemented in node, or even C/C++ for a pure-speed kind of thing. I’d also love to figure out a way to cache the parsed document so that I don’t have to parse the entire thing every time, but that’s a future optimization.

I’ve started a github repository  with an example of how I’d like a Lanky document to look at

I may end up abandoning this at some point because of time restrictions but that’s why I figured I’d get my first ideas about it online – maybe if there’s something good in there someone can steal it, or even better, point me to a project which already does this but better.

I called it “Lanky” because that was the first synonym for “thin” that didn’t have outright negative connotations or an existing PHP framework (slim, gossamer, etc).

From Boulder, CO


Should You Prefer Prefix over Postfix Increment?

I’ve been told in the past by a programming mentor that ++x is faster than x++, and I found myself refactoring a few increments in javascript the other day.

But then I got thinking – is it really faster? Wouldn’t most modern compilers optimize out the difference? I decided to do some science.

Here’s an outline of the code I ran on JSPerf:

    var x = 0;
    var obj = {
      x: 0

  // test one: 

  // test two:

  //test three:

  //test four:


For the most part, ++x has the same microperformance as x++.

Modern versions of Android Browser, Chrome, Firefox, Internet Explorer, and Safari all have similar performance for each of the benchmarks. This overrides my existing belief that prefix notation is faster.

In some browsers, there is a small but noticeable difference.

In FF19, ++x is faster than x++. But ++obj.x and obj.x++ are the same speed.

In FF31, ++x is faster than x++, but obj.x++ is faster than ++obj.x.

One interesting thing is that some browsers prefer x++ and others prefer ++x. The largest difference, FF31, is around a 1% increase in performance. But, Chrome Mobile loses that same amount (~1%), preferring x++ over ++x, so ultimately it’s a wash unless you’re targeting a specific browser.

From Manhattan,


Making Tea With Javascript: OOP with the Prototype Chain

Javascript is weird.

Prototypical inheritance is really powerful, but it’s quite a bit to wrap your mind around if you’re new to it. My first language was Java, and I’m comfortable with the “traditional” OOP paradigm. In this post, I’ll build a traditional Superclass/Subclass relationship in Javascript in an attempt to untangle the weirdness that is Javascript’s prototypical inheritance model.

All of the source code is available in a

Part 1: Superclass Constructor

Let’s brew a cup of tea.

//Superclass constructor
var Tea = function(options) {
    this.color = options.color || "herbal";
    this.caffeine = options.caffeine || 0;
    this.tannins = options.tannins || 0;
    this.minsSteeped = 0;

Here, we’ve created a constructor for some tea. This tea can’t really do anything, but it holds some useful information on whatever tea object we create in the future. I can make a cup of herbal tea by calling this with the new keyword.

var myHerbalTea = new Tea({});

 Part 2: Superclass Prototype

Now that we have an idea of how prototypes work, we can go ahead and construct a prototype that will be applied to instances of Tea.

Tea.prototype = {
  steep : function(cup) {
      this.caffeine = Math.max(0, this.caffeine - 1);
      if (this.caffeine) {
        cup.caffeine ++;

      cup.tannins += this.tannins * this.minsSteeped;

      cup.color = this.color;

      this.minsSteeped ++;

Now we create an object with a single method, steep, and assign that to be the prototype of Tea.  We usually want to put methods on the prototype, so that there’s only one copy of the function shared among all instances (this saves us a lot of memory).

After calling var myHerbalTea = new Tea({}), we’ll have the following inheritance structure:

Prototype Inheritance of myHerbalTea


Notice that the Tea function is not part of the prototype chain. It is simply a constructor function used to add the member variables (color, etc) to myHerbalTea. However, because Tea.prototype exists, it is chained to our instance of the Tea class.

Part 3: Subclass

Herbal tea is boring. Let’s make something to wake us up!

//Subclass constructor
var BlackTea = function(){
    //Put instance properties from the superclass constructor on the subclass instance, {
        color : "Black",
        caffeine : 10,
        tannins : 3
    this.hasMilk = false;

Here’s where the Javascript magic begins. And by magic I mean less of the Harry Potter and more of the Goat Sacrifice.

Let’s make some black tea:

var firstCup = new BlackTea();

This is another constructor function, composed of two main parts. First, we call the Tea() function, binding to the current instance. The call to Tea will have firstCup bound to this, which will apply all of the instance variables (color, etc), to firstCup. This is kind of like calling super() in a constructor in Java.

Here’s the relevant code. Everything that refers to firstCup when we create it is highlighted red.

var Tea = function(options) {
    this.color = options.color || "herbal";
    this.caffeine = options.caffeine || 0;
    this.tannins = options.tannins || 0;
    this.minsSteeped = 0;

// ...

var BlackTea = function(){, {
        color : "Black",
        caffeine : 10,
        tannins : 3
    this.hasMilk = false;

var firstCup = new BlackTea();

// ...

Ok, pop quiz. what is currently the prototype of firstCup?

Answer: undefined.

If you thought it was Tea, remember that Tea is just the constructor and is never really a “thing”.

If you thought it was Tea.prototype (I totally did), know that even though we do, we haven’t bound BlackTea‘s prototype yet, so firstCup.__proto__ is nothing.

Let’s set up the prototype and make a second cup.

Part 4: Subclass Prototype

Remember that the prototype of a class is the object that will be assigned to the __proto__ property of any instances created of that class. So in order to create a second cup of tea, we need to first change BlackTea.prototype.

BlackTea.prototype = Object.create(Tea.prototype);

var secondCup = new BlackTea();

It wasn’t obvious to me at first why we don’t bind BlackTea.prototype directly to Tea.prototype. Instead, we create an object whose prototype is Tea.prototype, and then set BlackTea.prototype to that new, empty object. Our secondCup object can still see the steep(cup) function, but it checks an empty object on its way up the prototype chain. Hmm…

But say we want to be able to add milk to our black tea. (Adding milk to green or herbal tea is icky and we shouldn’t allow our users to do that). If I modify BlackTea.prototype to be able to add milk:

BlackTea.prototype.addMilk = function(cup) {
    //adding milk makes the cup of tea less harsh!
    cup.tannins = Math.floor(cup.tannins / 2);
    this.hasMilk = true;

Remember that BlackTea.prototype is not Tea.prototype! It’s an object whose prototype is Tea.prototype. This means that addMilk is only available to instances of BlackTea, not any kind of tea.

Our prototype chain now looks like



Part 5: Actually Make Tea

//ok, let's make some tea
var myTea = new BlackTea();

var myCup = {
    color : "clear",
    caffeine : 0,
    tannins : 0

//steep for three minutes

//add some milk

//drink up
console.log(myCup, myTea);

This produces:
myCup is { color: ‘Black’, caffeine: 3, tannins: 4 }
myTea is { color: ‘Black’, caffeine: 7, tannins: 3, minsSteeped: 3, hasMilk: true }

Part 6: Recap

  • Javascript prototypal inheritance is super weird
  • Use the new keyword to treat a function as a constructor
    • The prototype of that function will become the __proto__ of the object, which is where the object looks for methods that aren’t declared locally.
    • Then you can call that constructor (like Java’s super()) using
  • Explicitly set prototypes to an object with the prototype you want to create
    • e.g. myObject.prototype = Object.create(Constructor.prototype)

I hope this blog post cleared up some of the mystery around prototypes and inheritance!

From Manhattan,

–Erty Seidohl

P.S. Thanks to Ryan McVerry and Julia Evans for proofreading! Also Michael Mulley for helping me understand the WTF-ness of .prototype not actually returning anything on an object.

SSD vs RAID0 for Gaming: SCIENCE!

A while ago, I bought an SSD (128GB Crucial M4) off Amazon, with the idea of putting it in my gaming rig as a “game cache”. My plan was to install my most played games on it, while the rest of my games sat on my current setup – Two 1TB Seagate Barracudas in RAID0. Here’s a cell phone pic of my setup:rigIgnore the awful position of the cable/drive on the new SSD – it’s for testing purposes.

At my current job, there’s a heavy reliance on data to drive decisions, and I decided to do some science here before actually moving my games over. And I’m glad I did. Here’s the data:

sequential random

E: RAID are the same raid drive – no difference, but two data collection runs, since the numbers were much more inconsistent. I had programs running on that drive while testing, meaning there’s a lot more noise. To do actual science I would run a lot more tests, but I feel that my results were good enough to make decisions on.

G: SSD is the SSD with two different stripe sizes: 4kb and 32kb. I believe the 4KB performed better because some cursory research showed that the drives are manufactured to be used with a 4kb block size, which makes sense.

Data was collected using Roadkil’s Disk Speed under light system load.

The interesting result is in the sequential/random difference on the RAID. In sequential reads, the RAID actually comes out faster than the SSD except at the 64kb read size. I believe this is because I have the RAIDs striped at 64KB, with 64KB blocks, and I must be hitting some sort of strange misalignment at exactly that size.

However, the RAID drops to basically zero (<1MB/s) when performing random read, while the SSD loses no speed at all. This is, of course, the main reason for getting an SSD.

Now, as far as I’m aware, games actually optimize for sequential read, since that’s how most hard drives are going to load them. What this means, as far as I can tell, is that I would actually be hurting my game performance by moving my games over to an SSD.

I’ll edit this post, after I play some Skyrim+HD Textures on the SSD and check if the load speeds feel any better.

Also: if anyone more experienced with hardware has any suggestions, I’m all ears!

From Brooklyn,