Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Latest commit

 

History

History
17 lines (11 loc) · 1.1 KB

2012605.md

File metadata and controls

17 lines (11 loc) · 1.1 KB
title
Ghcid and cabal common stanzas

Cabal's common stanzas feature can be used to allow ghcid to reload when the sources for a dependent library changes.

A common pattern used in Haskell projects is to have two build targets---library and executable. Ghcid is then used to launch the executable, as well as recompile and restart it when the executable sources change:

ghcid -c "cabal new-repl exe" -T :main

This works. But when the library sources themselves change, nothing would happen with the above ghcid instance. Ideally we would like ghcid to recompile and restart even if the library changes. This can be achieved by including the entire library stanza as-is in the executable stanza, which is a bit of cheating but it works fine. Cabal's common stanza feature just makes this less painful.

External links