Haskus system is a framework written in Haskell that can be used for system programming. Fundamentally it is an experiment into providing an integrated interface leveraging Haskell features (type-safety, STM, etc.) for the whole system: input, display, sound, network, etc.
It is based directly and only on the Linux kernel:
- it doesn't contain any kernel level code (device driver, etc.)
- it doesn't rely on usual interfaces (e.g., libdrm, libinput, X11, wayland, etc.) to communicate with the kernel
Note that it still depends on GHC's RTS dependencies (libc, etc.).
Some modules are quite orthogonal to the aim of the project and can be used independently. E.g.,
- the Variant type described here
- the file formats modules
- the memory layout modules to easily match C data types (struct, unions, bit fields, etc.) from Haskell code
- an x86-64 disassembler
How to build
Use stack commands to build Haskus system:
$ stack setup $ stack build
$ stack test
$ stack bench
Several utility programs are bundled with the framework:
ElfWeb program can be used to navigate into a ELF binary file. Use your Web browser to see the result.
$ stack exec -- ElfWeb -p 8020 ./mybinary & $ firefox http://localhost:8020
Show info about the x86 instructions recognized by Haskus system.
$ stack exec -- X86Web -p 8020 & $ firefox http://localhost:8020
Simple decompressor for the GZip format.
$ tar czf test.tgz # some files... $ stack exec -- gunzip test.tgz
Dump kernel system events (i.e. changes into the system tree) on standard output.
$ stack exec udev $ # try plugging or unplugging a device (USB stick, etc.)