GHCi scripts for standalone execution and Markdown documentation.
scripths lets you write .ghci scripts with dependency management and run them as standalone programs — or embed executable Haskell code blocks in Markdown files and evaluate them notebook-style with captured output.
Features
- Standalone
.ghciexecution — Run GHCi scripts directly from the command line, with automatic dependency. - Compiled or intepreted - you can either compile or interpret cells. Heavier functions can be compiled so they move fast and interactive parts can be kept interpreted.
- Cabal metadata directives — Declare
build-depends,default-extensions,ghc-options, and localpackagesinline using-- cabal:comments. - Markdown notebooks — Execute Haskell code blocks inside Markdown files and render the output back into the document as block quotes. Re-run in place with
-i— output is replaced cleanly, with no accumulating blank lines. - Inline errors — A block that fails to compile renders its GHC error beneath the block instead of producing silent empty output.
- Smart GHCi rendering — Multi-line definitions are automatically wrapped in
:{/:}blocks, and IO binds / Template Haskell splices are handled correctly as individual statements. - Compile-time TH reads your tree — A splice that reads a file at compile time (e.g.
$(declareTable "./data/x.db" …)) resolves./relativepaths against the directory you ranscripthsfrom, not the internal build directory. - Version tag — Files record the scripths that wrote them on their first line; running a file authored by a newer scripths than your binary prints a warning rather than failing.
Installation
cabal install scripths
CLI Usage
"scripths [-o FILE | --output=FILE] [-i | --in-place] [-p DIR | --package DIR]... [--no-local-project] [--code-style=display|remove] [--output-style=quoted|raw] [-h | --help] [-v | --version]