[Haskell-cafe] ANN: rapid, rapid-term: Rapid prototyping for Haskell
esz at posteo.de
Sat Dec 31 02:11:40 UTC 2016
I'd like to officially announce my rapid prototyping suite
unimaginatively called [Rapid] along with a helper library called
The traditional approach to rapid prototyping with Haskell is to have a
process running in the background that listens for source code changes
and then recompiles/reloads and restarts the application. I'll call
this process the *watcher*. This approach has a few drawbacks:
* The watcher is separate from the main GHCi instance used for
development. This means that the only access to the application
state you have is through the interfaces you have explicitly defined
in your code.
* Restarting the application entails losing all ephemeral state, all
network connections, all computed in-memory data, etc.
* The watcher typically doesn't understand individual application
components, so it's impossible to restart them individually.
Rapid uses Chris Done's [foreign-store] library to provide a rapid
prototyping framework for GHCi that lets you reload just the relevant
parts of your application while keeping everything else running
untouched, including all state, database/network connections, etc. It
runs directly in the GHCi instance used for development, so you can talk
to Rapid as well as your application from the REPL as it runs; no need
to define debugging interfaces. The goal is to shorten the development
cycle as much as possible.
Another example use case is the development of interactive GUI
applications. You can keep the GUI window open and preserve all of its
run-time state (text you have entered, list items you have created,
etc.), while reloading your application logic.
It can also be used by batch applications that don't run for extended
periods of time, for example to keep expensive resources in memory. For
example load and parse your giant data file once and just reuse the
resulting value across reloads.
There is a detailed [Rapid tutorial] in the documentation of the `Rapid`
module. It also walks you through Emacs haskell-mode integration.
Rapid-term is a helper library for the development of applications that
require an actual terminal. It spawns a separate terminal and keeps it
open for the duration of the GHCi session. The application can then
access this terminal and reuse it across runs.
There is a [rapid-term tutorial] in the documentation of the
`Rapid.Term` module, which also explains how to use rapid-term for rapid
prototyping of Vty applications (same story as for GUI applications, but
for Vty: keep your UI running, preserve your state, reload your
Feedback, bug reports and code contributions are highly welcome!
[rapid tutorial]: https://hackage.haskell.org/package/rapid-0.1.3/docs/Rapid.html
[rapid-term tutorial]: https://hackage.haskell.org/package/rapid-term-0.1.0/docs/Rapid-Term.html
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 487 bytes
Desc: not available
More information about the Haskell-Cafe