Moggi - a kind of strict version of Haskell running on JVM, .NET & PHP

Moggi 0.1.0-alpha is released today.

Moggi is a statically typed, purely functional programming language with strict evaluation. It has algebraic data types, GADTs, pattern matching, type classes, type inference, Generic Deriving, and an IO monad. It targets the JVM, .NET, and PHP, with typed FFI for existing Java, .NET, and PHP libraries.

The first release also includes a REPL, LSP, VS Code extension, moogle (code search), mogdoc (documentation generation), and a growing standard library.

This is an alpha release: the language and APIs are still evolving, and the standard library is still a work in progress.

I’d particularly like feedback from people interested in functional languages, type systems, compilers, and language/runtime interoperability.

4 Likes

reads “differences-to-haskell.md”

@moderators what’s the status of the “vibe coded content” tag that you mentioned was coming?

(btw on r/haskell i may be banned but i can still report as “not Haskell” lmao. EDIT: already removed - nice.)

2 Likes

I wouldn’t consider Moggi a vibe-coded language. If you’re able to one-shot something like this, even with multiple prompts, I’d honestly be impressed.

I made all the design decisions and defined the semantics, FFI, architecture, etc. LLMs were mainly used to generate some boilerplate where the constraints were already well defined. Rather than hiding the fact that I used LLMs for parts of it, I added a clear disclaimer to the repository.

3 Likes

How do you avoid getting stack overflows when constructing or manipulating very long lists? for example, in enumFromTo 0 (10**9)

Moggi already has tail-call optimization, so recursive list operations won’t overflow the stack. But a genuinely materialized list with a billion elements will still exhaust the heap.

The host languages have streaming mechanisms: Java has Iterator/Stream, .NET has IEnumerable<T>/yield, and PHP has Generator/yield. Moggi doesn’t have a streaming abstraction yet, but could eventually map one onto these.

2 Likes