Haskell in the cloud (Poor Man Edition)

Created: Wed Aug 22 20:02:00 CEST 2018

Last mod­i­fied: Tue Jan 29 05:52:39 CET 2019

Develop lo­cally, test re­motely, git com­mit lo­cally. This is my Haskell work­flow on FreeBSD.

Tools needed:


Before in­stalling the Haskell suite, you will need a swap­file. Especially if the vir­tual ma­chine has some­thing like 1gb of RAM.

You need one be­cause of a cur­rent is­sue with the Hackage cache con­sum­ing sev­eral gi­ga­bytes in mem­ory when up­dated.

Installing Stack and boot­strap­ping a new pro­ject

Connect to your server.

curl "https://get.haskellstack.org" | sh
stack new my-project haskeleton

You pro­ject is now lo­cated at ~/my-project.

Retrieve it from your server with rsync.

rsync -a user@server:my-project ./

Automating re­mote tests

Copy-paste the fol­low­ing in my-pro­ject/​run-test.sh.

#!/usr/bin/env sh
set -e
DIRNAME=$(basename $(pwd))
rsync -a ../$DIRNAME user@server:~/
ssh user@server \
  "cd $DIRNAME && stack test"

Et voilà!

cd ~/my-project && sh run-test.sh
# my-project
#   is trivially true: OK
# All 1 tests passed (0.01s)

source code