Fun Programming Language Documentation
Welcome to the Fun programming language! Fun is a purely functional programming language with type inference, built in Go with Tree-sitter parsing and LSP support.
Quick Navigation
- Language Guide - Learn the Fun language syntax and features
- Type System - Understanding Hindley-Milner type inference
- Standard Library - Built-in functions and types
- Modules - Code organization and imports
- REPL Guide - Interactive development environment
- IDE Support - VS Code extension and LSP features
- Examples - Code examples and tutorials
- Internals - Language implementation details
What is Fun?
Fun is a functional programming language designed for:
- Type Safety: Hindley-Milner type inference with polymorphic types
- Functional Programming: Lambda expressions, pattern matching, immutable data
- Developer Experience: REPL, LSP support, VS Code integration
- Performance: Tree-sitter parsing, efficient evaluation
Key Features
Functional Programming
- Lambda expressions:
\x -> x + 1 - Pattern matching with
whenexpressions - Immutable data structures
- Higher-order functions
Type System
- Automatic type inference
- Polymorphic types
- Type annotations when needed
- Compile-time type checking
Developer Tools
- Interactive REPL
- Language Server Protocol
- VS Code extension
- Syntax highlighting
Getting Started
- Install: Clone and build the project
- Try REPL: Run
./funfor interactive development - Run Programs:
./fun examples/basic/main - IDE Setup: Install the VS Code extension
Example
import lib from `./lib`
# computes the sum of integers from 1..n
sum_range : Lam<Int, Int>
sum_range = fix(\rec -> \n ->
when n == 0 is
True t -> 0;
False f -> n + rec(lib.dec(n))
)
sum_range(100) # result: 5050
Community
- Author: Matan Tsuberi tsuberim@gmail.com
- License: MIT
- Repository: GitHub
Start with the Language Guide to learn Fun programming!