Scripts2026年7月22日·1 分钟阅读

Roc — Fast Friendly Functional Programming Language

A statically typed functional programming language designed for speed, safety, and a friendly developer experience. Compiles to machine code with no runtime overhead.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Roc
先审查命令
npx -y tokrepo@latest install 45394c42-85aa-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

Roc is a statically typed functional programming language created by Richard Feldman (creator of Elm's architecture). It prioritizes fast compilation, fast execution, and a friendly developer experience with helpful error messages and minimal boilerplate.

What Roc Does

  • Compiles to native machine code for fast execution
  • Provides exhaustive pattern matching and algebraic data types
  • Offers a platform system for separating pure logic from side effects
  • Delivers fast incremental compilation for rapid feedback
  • Produces helpful error messages with suggested fixes

Architecture Overview

Roc uses a unique platform/application split. Applications contain pure business logic while platforms handle I/O and side effects. The compiler is written in Rust and Zig, producing LLVM IR that compiles to native binaries. This architecture enables guaranteed purity in application code while maintaining practical I/O capabilities through the platform layer.

Self-Hosting & Configuration

  • Install via the official installer or build from source
  • Create a new project with roc init
  • Choose a platform (basic-cli, basic-webserver) in your app header
  • No build configuration files needed; the app header declares dependencies
  • Supports cross-compilation for different target architectures

Key Features

  • No runtime exceptions with exhaustive pattern matching
  • Platform system cleanly separates pure and effectful code
  • Fast incremental compilation with sub-second rebuilds
  • Automatic memory management without garbage collection pauses
  • Friendly error messages designed for newcomers

Comparison with Similar Tools

  • Elm — Browser-only functional language; Roc targets general-purpose native applications
  • Haskell — Academic FP language; Roc prioritizes approachability and compilation speed
  • Rust — Systems language with ownership; Roc uses automatic memory management
  • OCaml — Mature ML family language; Roc offers simpler syntax and better error messages

FAQ

Q: Is Roc ready for production? A: Roc is pre-1.0 and under active development. It is usable for personal projects and experimentation.

Q: What platforms are available? A: basic-cli for command-line tools, basic-webserver for HTTP servers, and community platforms for other use cases.

Q: Does Roc have a package manager? A: Roc uses URL-based dependencies declared in the app header. A centralized registry is planned.

Q: How does memory management work? A: Roc uses automatic reference counting with compile-time optimizations to eliminate most overhead.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产