Dozer

Dozer is another programming language I’m probably never going to finish.

Hello World

fn main() [
  io.print-ln("Hello, world.");
  Nothing
];

Hello World (with Out Channel)

fn main() [
  "Hello, world.\n" # ~(r: Rune) r :> io.out;
  Nothing
];

Hello World (with Processes)

fn receive(c: Channel(Maybe(String))) loop! [
  s ::- <: c;
  match! s [
    Just(s) |> [
      s # ~(r: Rune) r :> io.out;
      Again
    ];
    Nothing |> Stop(Nothing);
  ]
];
fn main() [
  c ::- new(Channel(Maybe(String)));
  process(receive, (c));
  Just("Hello, world.\n") :> c;
  Nothing :> c;
  Nothing
];

Dozer’s statements are sometimes ;-separated, and sometimes ;-terminated. Top-level statements are ;-terminated, and so are match statements. Most other statements are ;-separated. Dozer’s control flow is done with built-in macros (e.g. loop!). Blocks are expressions that evaluate to their last statement. The following is a loop! implementation:

fn loop(b: Expr(std.loops.State)) [
  match! eval! b [
    Again |> loop(b);
    Stop(r) |> r;
  ]
];