mdr is a small (less than 500 Haskell SLOC 🍾) program and markup designed to facilitate documentation and testing.
I started it to ease Gwion's devellopment, but it is not tied in any way to this project.
Let' walktrough... 😄
let's write our first litterate progam.
@[[Includes]]
int main(int argc, char** argv) {
@[[Print]]
}As we need the puts function, we need stdio headers.
#include <stdio.h>puts("Hello, World!");with this line
@exec cc hello_world.c -o hello_worldwe compile hello_world.c.
Yes, there should be no output, and that good news.
Let's look at hello_world.c
@exec cat hello_world.c#include <stdio.h>
int main(int argc, char** argv) {
puts("Hello, World!");
}That's the content of the source file we generated (and compiled).
Then we run it
./hello_worldHello, World!Do we read Hello World! ? Assuming yes, let's continue.
Let's try it
[ "$(./hello_world)" = "Hello, World!" ] && echo "OK" || echo "NOT_OK"
and the result is
OKAs a haskell programm, it seemed natural to use cabal as a build system.
cabal buildAs easy as before, just type.
cabal installgenerated from this file
