Osprey for VS Code
Osprey is a functional language for apps, backends, ML and mathematics. Safe, elegant, fast. Nothing panics, types are inferred, and it compiles through LLVM to native code.
Every app above is Osprey, running natively on macOS and Windows. Try it in your browser.
The language
- Safe. Failures are
Result values you must handle. Matches must cover every case. Integer overflow follows a policy you choose.
- Elegant. Types are inferred. Effects replace plumbing. Concurrent code needs no
async.
- Fast. Native binaries, no VM, no JIT warm-up. Effect handlers are picked at compile time.
Declare what your code needs with effect. Supply it with handle. The app gets the real disk; the test gets a full one:
effect Files { write: fn(string, string) -> Result<int, string> }
fn install(name) = match perform Files.write("osprey.lock", "${name} = 2") {
Success _ => "installed"
Error { message } => "rolled back: ${message}"
}
let shipped = {
handle Files { write path text => writeFile(path, text) }
install("serde")
}
print(shipped)
test("a full disk rolls back", fn() => {
handle Files { write _ _ => Error { message: "disk full" } }
expect(install("serde"), "rolled back: disk full")
})
No type annotations. Drop the Error case or the handler and it won't compile. Write it with braces, ML indentation or the Python flavor; the GPT-2 port is Python flavor, on CPU or GPU.
Osprey is actively evolving. Try it on your projects and assess the risks before relying on it in production.
Debug
Press F5. Breakpoints, stepping, the call stack and variables, on your Osprey source, through LLDB-DAP. Debug a single test from the Testing view and it stops inside that case. Fiber and effect-handler views are still to come.
Profile
Run & Profile CPU on the open file, or attach to a program that's already running. You get a flame graph, and every hot function shows its share of the time right in the source. Watch the tutorial. Memory profiling and Windows sampling are still to come.
Prove
Osprey: Open Workbench. Write a proof step by step, with what you know and what's left to show beside it. Osprey's own kernel checks every step and tells you exactly why a wrong one fails. Workbench guide.
Also in the box
- Language server: errors across the whole repo, hover, go to definition, references, completion and formatting, from the compiler itself.
- Tests: run, cover, profile or debug any case from the Testing view. Skipped tests get flagged, never hidden.
- Modules view: every project in the workspace, named by its package (or its folder) with its summary beside it and its manifest on hover. Expand one for its namespaces, modules and members from the compiler, its source files and its dependencies with what verification found. The title bar sorts (alphabetical, source order, kind) and filters by name.
- Hunt for bugs: KLEE searches for inputs that break your program and marks them in the source. Details.
- Osprey Midnight theme: the editor, the Settings editor and your code in the colours of ospreylang.dev. Pick it under Preferences: Color Theme.
- Packages: add and remove packages from the Command Palette. Until the hosted registry launches, they come from an unverified local one. Walkthrough.
Requirements
The compiler ships inside the extension. To build and run programs, install LLVM (brew install llvm, or scoop install llvm gcc on Windows); to debug, add lldb-dap. For osprey on your command line:
brew install nimblesite/tap/osprey # macOS / Linux
scoop bucket add nimblesite https://github.com/Nimblesite/scoop-bucket && scoop install osprey # Windows
Website and docs · Source and issues · License