A small, weird and unpractical programming language.
Haskell
102
82 commits
updated Sep 20, 2026
fp is a programming language heavily inspired by the language John Backus
described in his 1977 Turing Award lecture.
The paper can be found here.
fp{- Matrix multiplication.
-}
Def ip ≡ /+∘α*∘⍉
Def mm ≡ α(α ip) ∘ α distl ∘ distr ∘ [~0, ⍉∘~1]
mm:< < <1,2>, <4,5> >,
< <6,8>, <7,9>> >
This section will give a quick tour of many of the language features of fp. It
will also cover the usage of the tools provided by fp.
fp can be used without explicitly installing it via nix!
nix run github:japiirainen/fp -- --help
Up to date
Usage: fp COMMAND
Command-line utility for the `fp` programming language
Available options:
-h,--help Show this help text
Available commands:
interpret Interpret a `fp` file
repl Enter a REPL for `fp`
The interpret command can be used to interpret fp files.
Def ip ≡ /+∘α*∘⍉
ip:<<1,2,3>,<6,5,4>>
This program lives in examples/ip.fp and can be interpreted like this.
cabal run fp -- interpret examples/ip.fp
Which will yield 28.
you can enter the fp repl to get an interactive environment:
fp repl
λ +:<1,2>
3
λ :let xs = <1,2,3>
λ xs
<1,2,3>
Currently the examples directory serves as the documentation! I will list some
important topics below for reference.
Conditionals
Fp has a condition expression. It is similar to ternary operator in many
ordinary languages.
While
while provides a way to run a specific program many times, specifically
until some condition is met.
Binary to unary
bu gives a convenient way to turn binary (2 argument) functions
into unary (1 argument) functions. This is kind of like partial
application.
Matrix multiplication
This example shows how to do matrix multiplication in fp.
Factorials
A way to compute factorials in fp.
Here's a bunch of primitive functions.
Unbound variable error
Fp also has nice error messages.
You can also run the test suite.
cabal test tasty
You can alternatively use nix for dev environment and for building the project.
Build:
nix build .
Run:
nix run .
Start Nix shell:
nix-shell
nix flake update to update all flake inputs../bin/hoogle to start Hoogle with packages in your cabal file.treefmt in nix shell to autoformat the project. This uses treefmt, which uses ./treefmt.toml (where fourmolu and nixpkgs-fmt are specified).nix run github:japiirainen/fp (or nix run . from checkout)fp is a programming language heavily inspired by the language John Backus
described in his 1977 Turing Award lecture.
Currently, almost all features described in the paper are implemented. This is not implemented:
Haskell
95.8%
GLSL
1.8%
Nix
1.8%
A small, weird and unpractical programming language.
Haskell
102
82 commits
updated Sep 20, 2026
fp is a programming language heavily inspired by the language John Backus
described in his 1977 Turing Award lecture.
The paper can be found here.
fp{- Matrix multiplication.
-}
Def ip ≡ /+∘α*∘⍉
Def mm ≡ α(α ip) ∘ α distl ∘ distr ∘ [~0, ⍉∘~1]
mm:< < <1,2>, <4,5> >,
< <6,8>, <7,9>> >
This section will give a quick tour of many of the language features of fp. It
will also cover the usage of the tools provided by fp.
fp can be used without explicitly installing it via nix!
nix run github:japiirainen/fp -- --help
Up to date
Usage: fp COMMAND
Command-line utility for the `fp` programming language
Available options:
-h,--help Show this help text
Available commands:
interpret Interpret a `fp` file
repl Enter a REPL for `fp`
The interpret command can be used to interpret fp files.
Def ip ≡ /+∘α*∘⍉
ip:<<1,2,3>,<6,5,4>>
This program lives in examples/ip.fp and can be interpreted like this.
cabal run fp -- interpret examples/ip.fp
Which will yield 28.
you can enter the fp repl to get an interactive environment:
fp repl
λ +:<1,2>
3
λ :let xs = <1,2,3>
λ xs
<1,2,3>
Currently the examples directory serves as the documentation! I will list some
important topics below for reference.
Conditionals
Fp has a condition expression. It is similar to ternary operator in many
ordinary languages.
While
while provides a way to run a specific program many times, specifically
until some condition is met.
Binary to unary
bu gives a convenient way to turn binary (2 argument) functions
into unary (1 argument) functions. This is kind of like partial
application.
Matrix multiplication
This example shows how to do matrix multiplication in fp.
Factorials
A way to compute factorials in fp.
Here's a bunch of primitive functions.
Unbound variable error
Fp also has nice error messages.
You can also run the test suite.
cabal test tasty
You can alternatively use nix for dev environment and for building the project.
Build:
nix build .
Run:
nix run .
Start Nix shell:
nix-shell
nix flake update to update all flake inputs../bin/hoogle to start Hoogle with packages in your cabal file.treefmt in nix shell to autoformat the project. This uses treefmt, which uses ./treefmt.toml (where fourmolu and nixpkgs-fmt are specified).nix run github:japiirainen/fp (or nix run . from checkout)fp is a programming language heavily inspired by the language John Backus
described in his 1977 Turing Award lecture.
Currently, almost all features described in the paper are implemented. This is not implemented:
Haskell
95.8%
GLSL
1.8%
Nix
1.8%