v0.2.0

A little magic in every line of code.

Pooka is a small, statically typed language for the BEAM. Immutable classes, interfaces, enums, pattern matching and actors, with errors you can hold in your hand, and good manners towards Erlang, Elixir and Gleam.

$ curl -fsSL https://pooka.run/install.sh | sh

On Windows? Follow the installation guide.

src/main.pooka
module main

import pooka/io
import pooka/list

class Lantern(name: String, lit: Bool)

glow(lantern: Lantern) -> String {
  match lantern.lit {
    True -> lantern.name + " is glowing"
    False -> lantern.name + " waits in the dark"
  }
}

main() {
  [Lantern("Ada", True), Lantern("Bo", False)]
  |> list.map(glow)
  |> list.each(fn(line: String) {
    let _ = io.println(line)
    Nil
  })
}
pooka run
   Compiled 1 module in 0.41s
    Running lantern.main
Ada is glowing
Bo waits in the dark
Pooka, a small dark creature with glowing eyes and an orange scarf, holding a lantern
01 Quick start

From nothing to running in a minute.

01

Make a project

A pooka.toml, a src/main.pooka and a first test.

pooka new lantern
cd lantern
02

Run it

Dependencies download, modules compile, main() runs.

pooka run
pooka test
03

Bring friends

Any Hex package works: Pooka, Erlang, Elixir or Gleam.

pooka add arglet
pooka add cowboy
02 A short walk

Read it once, remember it.

Every example below compiles and runs with Pooka 0.2.0.

classes.pooka
module main

class Creature {
  let name: String

  new(name: String) {
    self.name = name
  }

  greet() -> String {
    "..."
  }
}

class Owl is Creature {
  new(name: String) {
    super.new(name)
  }

  greet() -> String {
    "hoo"
  }
}

main() {
  let owl: Creature = Owl("Ada")
  echo owl.name + " says " + owl.greet()
}
pooka run
src/main.pooka:27
"Ada says hoo"
pooka build
error: non-exhaustive match
   ╭─ src/main.pooka:16:9
   │
16 │   match weather {
   │         ───┬───
   │            ╰─ not every main.Weather value is handled
   ╰─

Every possible value of the matched type must be handled.

help: Handle `Weather.Foggy` or add a fallback branch.
03 Diagnostics

Errors that help.

When something is wrong, Pooka points at it, says why, and suggests what to do next.

  • ✓
    LocatedFile, line and column, with the source right there.
  • ✓
    ExplainedA sentence about the rule, not just the symptom.
  • ✓
    ActionableA help: line naming the missing case or the likely fix.

Light the lantern.

Install Pooka, make a project, and say hello to the BEAM. The tour takes an evening; the cookbook is there whenever you're hungry.