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
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.
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.