Coal is a statically typed, purely functional programming language with Hindley–Milner type system, algebraic data types, extensible records, traits, and codata. The Coal compiler is implemented in Haskell.
See the official website for a language manual and getting started instructions.
As a total language, Coal takes a different approach to recursion, following the motto that "recursion is the goto of functional programming." To guarantee that programs are provably terminating, recursion is only available in a restricted form, known as structural recursion.
fun sum(numbers : List<int32>) : int32 =
fold(numbers) {
| [] => 0
| x :: @tot => x + tot
}
The language finds inspiration in ideas from the field of Mathematics of Program Construction, where streams and other infinite data types are described as coalgebras — hence the name Coal.
| Name | Description |
|---|---|
| 📦 coal-containers | A collection of functional data structures for the Coal programming language, providing efficient implementations of common container types. |
| 📦 coal-json | A JSON library for the Coal programming language, providing encoding, decoding, and pretty-printing of JSON values with composable decoder combinators and typeclass-based serialization. |
| 📦 coal-monads | A collection of common monad implementations for the Coal programming language. |
A Haskell library for constructing LLVM IR programmatically. It provides a monadic DSL for building modules, functions, blocks, and instructions, along with a pure renderer that serializes the result to LLVM assembly
You describe an IR module using the IRBuilder monad. When you run
compileModule, the builder produces an IRModule value. renderModule
then converts that value to the textual LLVM IR format that can be passed
to llc, clang, or lli. For example:
import LLVM.IR
example :: IRBuilder ()
example = do
define i32 "add_one" [(i32, "x")] LExternal [] $ do
beginBlock "entry"
r <- add i32 (OLocal i32 "x") (OConstant (CInt 32 1))
ret rRunning compileModule "example" example produces:
define i32 @add_one(i32 %x) {
entry:
%1 = add i32 %x, 1
ret i32 %1
}




