A dev container template for Haskell development with PostgreSQL.
| Component | Version |
|---|---|
| GHC | 9.6.7 |
| Cabal | 3.10.3.0 |
| Haskell Language Server (HLS) | 2.12.0.0 |
| PostgreSQL | 18.2 |
Shell: Zsh (default)
System tools: build-essential, curl, git, pkg-config, libffi-dev, libgmp-dev, libpq-dev, libssl-dev, zlib1g-dev, direnv, socat, procps, postgresql-client
VS Code extensions installed automatically:
- Haskell — HLS integration
- Haskell Syntax Highlighting
- GHCi
- direnv
- Error Lens
- EditorConfig
- SQLTools + PostgreSQL driver
- Markdown All in One
- markdownlint
- Docker
- VS Code with the Dev Containers extension
- Click Use this template on GitHub to create a new repository from this template.
- Clone your new repository and open it in VS Code.
- When prompted, click Reopen in Container (or run the command
Dev Containers: Reopen in Container). - The container will build and run the post-creation setup automatically. This may take several minutes on first build.
A PostgreSQL 18.2 instance runs as a companion service (db) in Docker Compose.
| Setting | Value |
|---|---|
| Host | db |
| Port | 5432 (also forwarded to localhost) |
| Database | db |
| User | postgres |
| Password | postgres |
You can connect from inside the container using psql:
psql -h db -U postgres -d dbOr use the SQLTools extension — a pre-configured connection named PostgreSQL - Local is available in the sidebar.
Note: These are local development credentials. Do not use them in production.
.
├── .devcontainer/
│ ├── devcontainer.json # Dev container configuration
│ ├── docker-compose.yml # App + PostgreSQL services
│ ├── Dockerfile # Haskell toolchain setup
│ └── post-create.sh # Post-creation setup script
├── .vscode/
│ └── settings.json # SQLTools connection + editor settings
├── .editorconfig # Consistent editor formatting rules
└── .gitignore # Haskell, Cabal, and VS Code ignores
Changing GHC or HLS versions: Update the version variables in .devcontainer/Dockerfile and update the versions mentioned in .devcontainer/post-create.sh welcome message accordingly.
Changing Cabal version: Update BOOTSTRAP_HASKELL_CABAL_VERSION in .devcontainer/Dockerfile.
Adding Cabal packages as dependencies: Create a cabal.project and .cabal package file at the root of the repository after cloning the template.
Using direnv for per-project environment variables: Add a .envrc file to the project root. direnv is pre-installed and hooked into both Bash and Zsh.