A statically-typed functional programming language with structural typing, pattern matching, lightweight processes, typed message passing, and postfix-based syntax.
Try Quiver in the online REPL// Define a recursive list type
list<t> : Nil | Cons[t, &];
// Import standard library
math = %"math",
// Compute the sum of a list using tail recursion
sum' = #[list<int>, int] {
| ~> =[Nil, acc] => acc
| ~> =[Cons[head, tail], acc] => {
math.add[head, acc] ~> &[tail, ~]
}
},
sum = #list<int> { ~> sum'[~, 0] },
// Build and sum a list
xs = Cons[1, Cons[2, Cons[3, Nil]]],
xs ~> sum // 6
Run the example above in the REPL (
quiv repl, or at quiver.run), or run the executable version in examples/sum.qv withquiv run examples/sum.qv.
- Postfix syntax: Data flows left-to-right through transformations
- Structural typing: Types are defined by their structure, not their names
- Pattern matching: Destructure and branch on values with expressive pattern syntax
- Union types: Model complex data with algebraic types
- Tail recursion: Efficient recursive algorithms via explicit tail-calls
- Concurrent processes: Erlang-inspired lightweight processes with typed message passing
See docs/spec.md for the complete language specification.
Clone the repository and build:
git clone https://github.com/joefreeman/quiver.git
cd quiver
cargo build --releaseThe compiled binary will be at target/release/quiv.
Run the REPL:
quiv replExecute a Quiver program:
quiv run program.qvquiv repl- Start an interactive REPL sessionquiv run [FILE]- Run a Quiver program (.qvsource or.qxbytecode)-e, --eval <CODE>- Execute code directly from the command line
quiv compile [FILE]- Compile source to bytecode-o, --output <FILE>- Write output to file-d, --debug- Include debug information in bytecode-e, --eval <CODE>- Compile code directly from the command line
quiv inspect <FILE>- Inspect compiled bytecode structure
All commands support reading from stdin when no file is specified.
Within the REPL:
\?- Show help message\q- Exit the REPL\!- Reset the environment\v- List all variables\p- List all processes\p X- Inspect process with IDX
MIT