floe 0.1.35

A programming language that compiles to TypeScript + React
Documentation

Floe is a functional language that compiles to TypeScript. Pipes, pattern matching, Result/Option types, and full npm interop. The compiler is written in Rust.

import trusted { useState } from "react"

type Todo {
  id: string,
  text: string,
  done: boolean,
}

export fn App() -> JSX.Element {
  const [todos, setTodos] = useState<Array<Todo>>([])

  const completed = todos
    |> filter(.done)
    |> length

  <div>
    <h1>Todos ({completed} done)</h1>
    {todos |> map((todo) => <p key={todo.id}>{todo.text}</p>)}
  </div>
}

Install

cargo install floe

Add to a Vite project

npm install -D @floeorg/vite-plugin
// vite.config.ts
import floe from "@floeorg/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"

export default defineConfig({
  plugins: [floe(), react()],
})

Write .fl files next to your .ts files. Import in either direction.

Links