gitmyhub

foi-lang

JavaScript ★ 327 updated 9h ago

Foi: a different kind of functional programming language

Foi is an experimental programming language blending functional and imperative styles, aiming to compile to WebAssembly, with an online playground to try it.

JavaScriptWebAssemblysetup: moderatecomplexity 4/5

Foi is a new programming language created by Kyle Simpson, who is also known for his extensive JavaScript writing. The language is designed as a practical blend of two styles of programming: functional programming, which treats computation as a series of transformations without hidden side effects, and imperative programming, which is the more traditional step-by-step style most developers learn first.

The goal is a language that developers with some experience in either style can learn in a few days, not months. It borrows ideas from several existing languages but is its own thing with its own syntax. Code examples in the README show patterns like function definitions, pattern matching, partial application, and function composition, all of which are concepts from functional programming but written in a style the author describes as readable and approachable.

Foi is intended for general application programming. The planned compilation target is WebAssembly, which would let Foi programs run in web browsers, on servers, and on mobile devices. As of the README, that compilation path is not yet complete.

There is an online playground at toy.foi-lang.com where you can try Foi code without installing anything. The repository also includes a command-line tool called Foi-Toy for running Foi locally, a guide document covering most of the language, a formal grammar for the language, and a cheatsheet comparing Foi syntax to equivalent JavaScript.

Where it fits