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
Add to a Vite project
// 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.