aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: 58c28dd1a153d30a7a35d8c42d713d7a4169338f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// This is the test unit, not the actual code.

#include "moonshine.h"

datatype(binarytree, ((leaf, int), (node, binarytree *, int, binarytree *) ));

int main() {
    const auto tree = instance(binarytree, leaf, 3);

    print(&tree);

    match(tree) {
        of(leaf, v) print("Leafy ", v);
        of(node, _, v, _) print("Nodey ", v);
        other() print("Idk man");
    }

    return 0;
}