A statically typed, purely functional, strictly evaluated language that compiles to PHP, the JVM and .NET.
Algebraic data types, GADTs, pattern matching, type classes and explicit-effect
IO. One source compiles to a PHP .phar, a JVM .jar, a
.NET .dll, or a native executable — the compiler is written in PHP,
and every release ships the runtimes it needs.
data Shape = Circle Double | Rect Double Double
deriving (Show, Eq)
area :: Shape -> Double
area s = case s of
Circle r -> 3.141592653589793 * r * r
Rect w h -> w * h
main :: IO ()
main = do
putStrLn (show (area (Circle 1.0)))
putStrLn (show (map area [Rect 2.0 3.0, Circle 1.0]))
3.141592653589793
[6.0, 12.566370614359172]
Pick your platform and the distribution you want. Unpack the archive and run it: there is nothing to install, configure or build.
Download moggi-0.1.0-alpha-linux-x86_64.tar.gz
$ curl -LO https://github.com/moggi-lang/moggi/releases/download/0.1.0-alpha/moggi-0.1.0-alpha-linux-x86_64.tar.gz
$ tar -xzf moggi-0.1.0-alpha-linux-x86_64.tar.gz
$ cd moggi && ./bin/moggi version
The picker above needs JavaScript; every archive is listed
below either way. Check the download against SHA256SUMS
(sha256sum -c SHA256SUMS; shasum -a 256 on macOS) — the
archives are not code-signed yet, and
quickstart covers what
macOS and Windows say about that on first run.
They are the same compiler; only runtime/ differs. A bundled runtime
is used in preference to the one on your PATH, and whatever a variant
does not bundle has to be installed yourself.
| Distribution | Bundles |
|---|---|
moggi | PHP, .NET SDK, JDK, GraalVM — everything, including --native |
moggi-php | PHP — the PHP backend |
moggi-dotnet | PHP and the .NET SDK |
moggi-jvm | PHP, JDK and GraalVM |
moggi-minimal | nothing — uses the php, javac/java and dotnet on your PATH |
Windows archives are .zip; the rest are .tar.gz.
Windows on ARM64 gets no distributions: php.net publishes no Windows ARM64 PHP,
so there is nothing to bundle and nothing for moggi-minimal to fall
back to. The x86_64 archives run under emulation there. Everything else about the
release — the checksums, the provenance attestation, how each runtime is pinned —
is in dist/README.md.
base package: the pages that
release published, served by the registry.Early, and honest about it: the compiler is complete enough to be self-hosting-adjacent (it compiles its own standard library and packages a distribution), the package registry is being specified, and the language is changing.