When I try to install it with cabal, I get
~$ cabal install ghc-mod
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/haskell-src-exts-1.1
It turned out to be a running-out-of-memory issue, as hammar suspected. I was able to get it to install (although it was painfully slow) by adding a 1GB swap file to the system:
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile
Apparently EC2 instances come without swap by default.