Moggi Compiler. Contribute to moggi-lang/moggi development by creating an account on GitHub.
1 comment
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.
A small example:
```moggi data Shape = Circle Double | Rect Double Double deriving Show
class Area a where area :: a -> Double
instance Area Shape where area shape = case shape of Circle r -> 3.141592653589793 * r * r Rect w h -> w * h
data Reading = Reading { label :: String, shape :: Shape }
render :: Reading -> String render reading = let thisShape = reading.shape in reading.label <> ": " <> show (area thisShape)
main :: IO () main = do putStrLn (render (Reading { label = "unit circle", shape = Circle 1.0 })) putStrLn (render (Reading { label = "3x4", shape = Rect 3.0 4.0 }))
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.
Read the full thread on Hacker News →
Related stories
- Typed properties in PHPstitcher.ioLobsters · 7 points · over 7 years ago
- Porting Extensions to PHP 8seidengroup.comLobsters · 5 points · almost 6 years ago
- Hacker News · 2 points · 4 days ago
- Moving .NET 8/9 apps to .NET 10 before Nov 10: a checklist with links to every breaking changedev.toDEV Community · 0 points · 4 days ago
- PHP 4.1.1 Simulator: A jsfiddle-style edit-run page for 2001 era PHPsimphp.infinitefun.comHacker News · 1 points · 4 days ago
- Show HN: NetWasm – Independent .NET Compiler/Runtime (82.5 KB Hello World in C#)playground.netwasm.comHacker News · 5 points · 1 day ago