essence-of-live-coding is a general purpose and type safe live coding framework in Haskell. You can run programs in it, and edit, recompile and reload them while they're running. Internally, the state of the live program is automatically migrated when performing hot code swap.
The library also offers an easy to use FRP interface. It is parametrized by its side effects, separates data flow cleanly from control flow, and allows to develop live programs from reusable, modular components. There are also useful utilities for debugging and quickchecking.
- https://github.com/turion/essence-of-live-coding
- https://www.manuelbaerenz.de/#computerscience
- https://www.manuelbaerenz.de/essence-of-live-coding/EssenceOfLiveCoding.pdf
- Clone this repository and enter it:
git clone https://github.com/turion/essence-of-live-coding-tutorial cd essence-of-live-coding-tutorial
- Either install
nix
and launch anix-shell
, or install the external dependencies listed below cabal update
(A new version of the library was released recently)- Sanity check: Launch
cabal repl
and close it again. This should succeed without errors. - Open
Main.hs
in an editor. - Run
ghcid
from the console.
You should now be seeing a window containing a solid circle (a ball).
If you click anywhere in the window, the ball will start to move in that direction.
Once you make changes to Main.hs
,
it will automatically reload.
- Ideally, a Linux system. (See below.)
- A standard Haskell development environment, including
cabal
andghci
. (stack
is not needed.) Supported GHC versions are 8.6 and 8.8. ghcid
.- OpenGL development libraries and PulseAudio development libraries.
(For other sound setups, see below.)
In Debian-based systems, this amounts to installing these packages:
libgl1-mesa-dev
libglu1-mesa-dev
freeglut3-dev
libpulse-dev
libblas-dev
liblapack-dev
- The
nix-shell
is pinned to an up-to-date version ofnixos-unstable
. This may cause a long build. You can alleviate that by usingcachix
, or using a differentnixpkgs
version. - If you use
cachix
, you can speed up your build by usingcachix use manuelbaerenz
. I'm uploading build artifacts there. - To use a different
nixpkgs
, edit the first lines ofmypkgs.nix
, and re-runnix-shell
.
I cannot give Windows support for graphics, since I don't have a Windows machine. If you have a Windows machine, you'd like to get graphics to run on your machine, and you're willing to test a backend and setup with me, please contact me via a Github issue.
Graphics/OpenGL support on macOS seems to be broken, see #3. If you know how to fix such an issue, please comment, and we'll resolve it so you can use graphics on macOS.
Currently, I only have audio support ready for Linux, PulseAudio, since this is the platform on which I develop. If you have a different system, we will still be able to get sound working if you know of good Haskell bindings to your sound system. If that is the case, please open an issue on https://github.com/turion/essence-of-live-coding/issues so we can prepare a sound backend before the tutorial.
Either way, the tutorial will focus mainly on video, and only add further backends as time permits.
- Basics of composable vector graphics in Gloss: http://hackage.haskell.org/package/gloss-1.13.1.2/docs/Graphics-Gloss-Data-Picture.html
- LiveCoding reference documentation:
- Vector space operations: http://hackage.haskell.org/package/vector-space-0.16/docs/Data-VectorSpace.html
- Web Application Interface reference documentation:
Task | Branch |
---|---|
Magnet (Ball stops when it is very slow) | progress1_magnet |
Goal hole with high friction | progress2_goal |
Obstacle type | progress3_obstacle_type |
Draw obstacles, simulate repulsion | progress4_obstacles |
Connect warp backend, print last query | progress5_connect_warp |
Parse warp impulse query | progress6_warp_impulse |
Stretch goal: Add sound | solution_pulse |