Skip to content

Funxy - A new programming language

Choose a tag to compare

@funvibe funvibe released this 08 Dec 19:25
· 64 commits to main since this release

What is Funxy?

A hybrid programming language with static typing, pattern matching, and built-in binary data support.

  • Hybrid — imperative (if/for) and functional (map/filter/match) styles mix freely
  • Static typing with inference — types checked at compile time, but rarely need explicit annotations
  • Single binary — download and run, no dependencies

Highlights

Pattern Matching with String Patterns

fun route(method, path) {
    match (method, path) {
        ("GET", "/users/{id}") -> "User: ${id}"
        ("GET", "/files/{path...}") -> "File: ${path}"
        _ -> "Not found"
    }
}

Pipes for Data Transformation

import "lib/list" (filter, map, foldl)

[1, 2, 3, 4, 5]
    |> filter(fun(x) { x % 2 == 0 })
    |> map(fun(x) { x * x })
    |> foldl(fun(acc, x) { acc + x }, 0)
// 20

Binary Data Parsing

import "lib/bits" (bitsExtract, bitsInt)

packet = #b"010010"  // SYN + ACK
specs = [bitsInt("syn", 1), bitsInt("ack", 1), ...]

match bitsExtract(packet, specs) {
    Ok(flags) -> print(flags)
    Fail(e) -> print(e)
}

Powered by funbit — Erlang bit syntax for Go.

Tail Call Optimization

fun countdown(n, acc) {
    if n == 0 { acc }
    else { countdown(n - 1, acc + 1) }
}

countdown(1000000, 0)  // Works, no stack overflow

TCO also works for mutual recursion.

Cyclic Module Dependencies

Modules can import each other — the analyzer resolves cycles automatically.

Standard Library

Module Description
lib/list map, filter, foldl, sort, zip, range
lib/string split, trim, replace, contains
lib/json jsonEncode, jsonDecode
lib/http HTTP client and server
lib/ws WebSocket client and server
lib/sql SQLite (built-in)
lib/bits Bit-level parsing
lib/bytes Byte manipulation
lib/task async/await
lib/crypto sha256, md5, base64, hmac
lib/regex Regular expressions
lib/io Files and directories
lib/sys Args, env, exec
lib/date Date and time
lib/uuid UUID generation
lib/math Math functions
lib/bignum BigInt, Rational
lib/test Unit testing
lib/log Structured logging

Run ./funxy -help lib/<name> for documentation.

What's Included

  • Binary for your platform (macOS, Linux, Windows, FreeBSD, OpenBSD)
  • Source code — build with make build (requires Go 1.25+)
  • Documentation — docs/tutorial and docs/funbook
  • Web Playground — ./funxy playground/playground.lang, then open http://localhost:8080
  • Editor support — VS Code/Cursor and Sublime Text extensions in editors/

Quick Start

# Download binary for your platform
mv funxy-darwin-arm64 funxy

# Hello World
echo 'print("Hello, Funxy!")' | ./funxy

# Run from file
./funxy hello.lang

# Web playground
./funxy playground/playground.lang

# Help
./funxy -help
./funxy -help lib/http

File Extensions

Supported: .lang, .funxy, .fx

Known Limitations

  • Performance: Tree-walking interpreter. Great for I/O-bound tasks, not for CPU-intensive computations without TCO.

Feedback

Issues, suggestions, and PRs welcome at github.com/funvibe/funxy