Koka is a strongly typed functional-style language with effect types and handlers -- generating direct C code without needing a runtime system. To learn more:
-
View the Koka Samples in VS Code by opening the command panel (
Ctrl/Cmd+Shift+P), and running theKoka: Open samplescommand.
(when you start typing the command will surface to the top). -
Read the Koka book for a tour of the Koka language and its specification.
- Todo
-
Top-level definitions that start with
wrong/can have static (type) errors and will be ignored (but the errors are still showed as warnings). This expands on definitions that start withtestorexamplewhich can be run directly from the IDE. -
Expand inlay hints to show the eta-expanded underscore syntax (since v3.2.0).
-
New implicit resolving algorithm (which is better at avoiding exponential search time).
-
Fix common cause for exponential search in overload resolution
-
Improve auto eta-expansion of implicits
-
Support for locally qualified names for parameters and local values and functions.
-
Implicit parameter resolving must be unambigious now (and we no longer use the shortest chain rule). However, we still prefer names declared in an inner scope.
-
Implicit parameters can be passed as a regular argument (and are no longer required to be named), e.g.
[1].println(list/show). -
Breaking change: the hole in a constructor context must now be denoted with the
holekeyword (and no longer with an underscore). -
Support underscore syntax as a shorthand for eta-expansion. For example,
[1].map(inc(_))expands to[1].map(fn(x) inc(x)),
or[1].map(1 + _)expands to[1].map(fn(x) 1 + x).The rule is to eta-expand any underscores sequentially up to the innermost argument position (unless the argument is a single underscore by itself) -- e.g.,
zipwith([1],[3], _.inc.max(_) )expands tozipwith([1],[3], fn(x,y) x.inc.max(y) ), and[1].println(list/show(_,int/show(_)))expands to[1].println(fn(xs) list/show(xs,fn(x) int/show(x))). -
Update the mimalloc allocator to v2.2.4
-
Initial support for phantom implicits. Such implicit parameters can be solved automatically by the compiler. At this point we only support the
:hdiv<h,a,e>constraint that signifies that if:hoccurs in:a, then:emust include the:diveffect. There is no more support for predicates and qualified types -- it is all just implicit parameters now.
-
Fix optimized compilation from VS Code (which defaulted to lower optimization before)
-
Add applier syntax
.()wherex.f.(42)is sugar for(x.f)(42)which can be convenient when calling functions selected from astruct. -
Improve Windows installation, check clang version and Windows build tools.
-
Declare reference types as
reference type(instead ofref type).
All types are by default reference types except for enumerations (all singleton) or isomorphic types (single constructor with one field, i.e. anewtype). -
Declare divergent types as
div type/effect(instead ofrec type/effect). -
Support for lazy constructors. See
samples/learn/lazycons.kkin the Samples, and read the paper on "First-order Laziness" by Anton Lorenzen, Daan Leijen, Wouter Swierstra, Sam Lindley (ICFP'25). -
Various bug fixes.
-
Interim release to fix the Koka installation from VS Code when starting outside of a workspace.
-
View the talk on the design and compilation of efficient effect handlers in Koka as part of Xavier Leroy's beautiful lecture series on control structures and algebraic effects at the Collège de France (with many other invited talks available online).
-
Read the paper on "The Functional Essence of Binary Search Trees" by Anton Lorenzen, Daan Leijen, Sam Lindley, and Wouter Swierstra to be presented at PLDI'24 on June 27.
-
Various fixes and contributions from Xia Li-yao, Eduardo García Maleta, and @samosica
- Fix crash in language server; fix build on older gcc versions.
-
Language Server now supports the stdio protocol via the
--language-server --lsstdiocombination of flags. -
Building is now highly concurrent with much faster build times.
-
Internal redesign of (named) effect generation to match the formal systems more closely. See
samples/handlers/namedfor examples. -
Clarified evidence vector API, and various other improvements and bug fixes.
-
Improved VS Code integration with better hover and inlay information.
-
Revised
std/corewhich is now split in separate modules. -
Fixed infinite expansion bug in the implicit parameter resolver, and various other small bug fixes.
-
Introducing locally qualified names to always be able to refer to (overloaded) identifiers explicitly. See the
samples/basic/qualifiersexample for more information. (use theKoka: Open samplescommand to open the samples directory). -
Implicit parameters are a new experimental feature that allow parameterized overloading of equality, show, etc. See the
samples/basic/implicitsexample for more information. -
Many improvements to the VS Code integration. Press and hold
ctrl+alt(orctrl+optionon MacOS) to show inlay hints -- showing inferred types, fully qualified names, and implicit arguments.
-
Using the new first-class constructor contexts to improve efficiency of various
std/corefunctions likepartition. See thesamples/learn/contexts.kkexample for an overview, and the accompanying paper for an in-depth discussion. -
Using further fully in-place
fipandfbipannotations for variousstd/corefunctions. See thesamples/learn/fip.kkexample for an overview and the paper for a more technical overview. -
Initial VS Code language support with type information, jump to definition, run test functions directly from the editor, automatic Koka installation, and many more things. Special thanks to Tim Whiting and Fredrik Wieczerkowski for all their work on making this possible!
-
The ability to run
main,test..., andexample...functions directly from the editor by clicking on therun debug | optimizedcode lenses.
-
The VS Code extension prompts to automatically install the latest Koka compiler.
-
Various bug fixes and extended bit-level operations on
int32/int64.
Enjoy!
-
v2.4.2, 2023-07-03: interim release with support for the newfipandfbipkeywords to support fully-in-place programming. Various bug fixes and performance enhancements. -
v2.4.0, 2022-02-07: automatic generation of installation packages for various Linux distributions (by Rubikscraft), improved specialization and integer add/sub, addrbtree-fbipsample, improve grammar (pub(instead ofpublic, remove private (as it is always default)),final ctl(instead ofbrk), underscores in number literals, etc), renamedoubletofloat64, various bug fixes. -
v2.3.8, 2021-12-27: improvedintperformance, various bug fixes, update wasm backend, initial conan support, fix js backend. -
v2.3.6, 2021-11-26: fix specialization bug, addstd/os/readlinemodule. -
v2.3.4, 2021-11-26:maybe-like types are already value types, but now also no longer need heap allocation if not nested (and[Just(1)]uses the same heap space as[1]), improved atomic refcounting (by Anton Lorenzen), improved specialization (by Steven Fontanella), various small fixes, fix build on freeBSD. -
v2.3.2, 2021-10-15: initial wasm support (use--target=wasm, and install [emscripten] and [wasmtime]), improved reuse specialization (by Anton Lorenzen), fix default color scheme for non-dark shells (#190), stack-less free and marking, add--stackoption, [musl] support (use--cc=musl-gcc), fixvcpkgsupport on macOS with homebrew installed vcpkg, various bug fixes. -
v2.3.1, 2021-09-29: improved TRMC optimizations, and improved reuse (the rbtree benchmark is faster as C++ now). Improved effect operation speed. Allow elision of->in anonymous function expressions (e.g.xs.map( fn(x) x + 1 )) and operation clauses. Allowctlforcontrol. New default output directory as.kokaand improved command line options to be more in line with other compilers (with-ospecifying the final output, and-eto execute the program). -
v2.3.0, 2021-09-20: many changes: new layout rule to [elide braces][nobrace] and no more need to parenthesizeifandmatchconditions (see thesamples/basic/rbtreefor an example of this), updated the JavaScript backend (--target=js) to use standard ES6 modules and using the newBigIntfor arbitrary precision integers, improved runtime layout with support for 128-bit arm CHERI, add thestd/num/int64module andint64primitive type, add the binarytrees benchmark, initial support for parallel tasks (instd/os/task), improved simplification and inlining giving much improved effect operations, updated isocline for the interactive environment. -
v2.2.1, 2021-09-05: improved optimization, initial parallel tasks, binary-trees benchmark, still slightly slower effect handling, upgrade isocline, fix minor bugs. -
v2.2.0, 2021-08-26: improved case-of-known simpification (by Rakshika B), improve cross-module specialization (by Steven Fontanella), initial borrowing annotations and improved reuse analysis (by Anton Lorenzen), improved line editing in the interactive environment, improved inlining. Note: due to the new inline phases, effect handling may currently be a tad slower in this release but will be improved for the next release. -
v2.1.9, 2021-06-23: initial support for cross-module specialization (by Steven Fontanella). -
v2.1.8, 2021-06-17: initial support for macOS M1 and Linux arm64, improved readline, minor fixes. -
v2.1.6, 2021-06-10: initial support for shallow resumptions, fix space leak with vectors, allowgccwith--fasan, improvedvcpkgsupport, add--fstdallocflag, improved VS code syntax highlighting, improvedvalgrindsupport, added--no-optimizeflag for extended debug information. -
v2.1.4, 2021-05-31: remove dependency on cmake, support library linking, support vckpg, updatedstd/text/regex, improved Windows installer withclanginstall included, remove dependency on Visual Studio on Windows, improved--fasansupport, fixed space leak on boxed value types, use signedsize_tinternally, various small bug fixes. -
v2.1.2, 2021-05-01: various bug fixes, allow pattern bindings in parameters of anonymous functions (by Steven Fontanella), initial Emacs syntax highlighting (by Kamoii). -
v2.1.1, 2021-03-08: bug fixes, use right-associative (++) for string- and list append (instead of (+)), improved internal string handling. -
v2.0.16, 2021-02-14: bug fixes, fix short-circuit evaluation of logical operations, improved utf-8 handling. -
v2.0.14, 2020-12-11: bug fixes, improved var escape checking. -
v2.0.12, 2020-12-02: syntax highlighting support for VS Code and Atom, improved uninstall, more samples. -
v2.0.9, 2020-11-27: now with binary [releases] for Windows, macOS, and Linux. -
v2.0.7, 2020-11-23: more small fixes, improved scoped handlers, improved higher-rank type propagation, more samples. -
v2.0.5, 2020-11-15: many bug fixes and improvements. Improved codegen, named handlers, added samples, docker support, direct C compilation, local install support. -
v2.0.0, 2020-08-21: initial v2 release.


