A functional language that compiles to TypeScript. Pipes, pattern matching, Result/Option types, and full npm interop.
Warning
Floe is experimental. The language is pre-1.0, under active development, and should not be used in production. Expect bugs, rough edges, and breaking changes to the syntax, compiler output, and public APIs between releases. Pin your version and read the CHANGELOG before upgrading.
import trusted { useState } from "react"
type User = {
name: string,
role: string,
active: boolean,
}
type Status =
| Loading
| Failed(string)
| Ready(Array<User>)
export let Dashboard() -> JSX.Element = {
let (status, setStatus) = useState<Status>(Loading)
status |> match {
Loading -> <Spinner />,
Failed(msg) -> <Alert message={msg} />,
Ready(users) -> {
let active = users
|> filter(.active)
|> sortBy(.name)
<div>
<h2>{active |> length} active</h2>
{active |> map((u) ->
<Card key={u.name} title={u.name} badge={u.role} />
)}
</div>
},
}
}