MCPcopy Index your code
hub / github.com/MercuryTechnologies/ghciwatch

github.com/MercuryTechnologies/ghciwatch @v1.4.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.4.2 ↗ · + Follow
756 symbols 2,201 edges 101 files 257 documented · 34%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ghciwatch

Packaging status

Packaging status

User manual

[!NOTE] Mercury is migrating our backend build to Buck2 after outgrowing the Cabal build system. As a result, ghciwatch is currently in maintenance mode: we are not developing new features and code review bandwidth is limited.

For more information on Mercury's Buck2 migration, see some of the conference talks by our engineers and contractors: - "Integrating Nix and Buck2 for fun and profit" by Claudio Bley (Tweag) at NixCon 2024 (31 minutes). - "Remote Execution with Buck2 and Nix" by Claudio Bley (Tweag) at FOSDEM 2025 (20 minutes). - "Haskell Builds at Scale: Comparing Bazel and Buck2" by Andreas Herrmann (Tweag) at BazelCon 2025 (32 minutes).

Ghciwatch loads a GHCi session for a Haskell project and reloads it when source files change.

Features

  • GHCi output is displayed to the user as soon as it's printed.
  • Ghciwatch can handle new modules, removed modules, or moved modules without a hitch
  • A variety of lifecycle hooks let you run Haskell code or shell commands on a variety of events.
  • Run a test suite with --test-ghci TestMain.testMain.
  • Refresh your .cabal files with hpack before GHCi starts using --before-startup-shell hpack.
  • Format your code asynchronously using --before-reload-shell async:fourmolu.
  • Custom globs can be supplied to reload or restart the GHCi session when non-Haskell files (like templates or database schema definitions) change.
  • Ghciwatch can clear the screen between reloads.
  • Compilation errors can be written to a file with --error-file, for compatibility with ghcid's --outputfile option.
  • Comments starting with -- $> can be evaluated in GHCi.
  • Eval comments have access to the top-level bindings of the module they're defined in, including unexported bindings.
  • Multi-line eval comments are supported with {- $> ... <$ -}.

Demo

Check out a quick demo to see how ghciwatch feels in practice:

Learn More

Read the manual here.

Developing ghciwatch

See CONTRIBUTING.md for information on hacking ghciwatch.

Extension points exported contracts — how you extend this code

Matcher (Interface)
A type which can match log events. [8 implementers]
test-harness/src/matcher/mod.rs
CommandExt (Interface)
Extension trait for commands. [4 implementers]
src/command_ext.rs
StringCase (Interface)
Extension for changing the case of strings. [1 implementers]
src/string_case.rs
AhoCorasickExt (Interface)
Extension trait for [`AhoCorasick`]. [1 implementers]
src/aho_corasick.rs
IntoMatcher (Interface)
A type that can be converted into a [`Matcher`] and used for searching log events. [5 implementers]
test-harness/src/matcher/into_matcher.rs

Core symbols most depended-on inside this repo

fs
called by 59
test-harness/src/ghciwatch.rs
path
called by 52
test-harness/src/ghciwatch.rs
wait_for_log
called by 47
test-harness/src/ghciwatch.rs
as_ref
called by 38
src/normal_path.rs
wait_until_ready
called by 37
test-harness/src/ghciwatch.rs
clone
called by 37
src/ghci/writer.rs
start
called by 36
test-harness/src/ghciwatch.rs
push
called by 34
src/shutdown.rs

Shape

Method 418
Function 220
Class 83
Enum 30
Interface 5

Languages

Rust100%

Modules by API surface

test-harness/src/ghciwatch.rs47 symbols
src/incremental_reader.rs38 symbols
src/ghci/mod.rs35 symbols
test-harness/src/matcher/base_matcher.rs27 symbols
src/hooks.rs27 symbols
src/normal_path.rs26 symbols
src/ghci/progress_writer.rs24 symbols
src/shutdown.rs22 symbols
src/ghci/manager.rs22 symbols
test-harness/src/fs.rs17 symbols
src/tui/mod.rs17 symbols
src/ghci/stdin.rs16 symbols

For agents

$ claude mcp add ghciwatch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page