Skip to content

Commit

Permalink
Merge branch 'dev' into feature/borrow
Browse files Browse the repository at this point in the history
  • Loading branch information
daanx committed Oct 15, 2021
2 parents e2e7381 + 5c08967 commit 86b1ee9
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 47 deletions.
20 changes: 13 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Koka: a Functional Language with Effects

_Koka v2 is a research language that currently under heavy development with the new C backend_
_Latest release_: v2.3.1, 2021-09-29 ([Install]).
_Latest release_: v2.3.2, 2021-10-15 ([Install]).

<a href="https://koka-lang.github.io/koka/doc/book.html#why-handlers"><img align="right" width="300" src="doc/snippet-yield.png" /></a>

Expand Down Expand Up @@ -67,6 +67,9 @@ To learn more:
[nobrace]: https://koka-lang.github.io/koka/doc/book.html#sec-layout
[m1arch]: https://cpufun.substack.com/p/setting-up-the-apple-m1-for-native
[bigint]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
[emscripten]: https://emscripten.org/docs/getting_started/downloads.html
[musl]: https://musl.libc.org/
[wasmtime]: https://wasmtime.dev/

Enjoy,
Daan Leijen
Expand All @@ -77,6 +80,10 @@ and all previous interns working on earlier versions of Koka: Daniel Hillerströ

## Recent Releases

- `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 `--stack` option,
[musl] support (use `--cc=musl-gcc`), fix `vcpkg` support on macOS with homebrew installed vcpkg, various bug fixes.
- `v2.3.1`, 2021-09-29: improved TRMC optimizations, and improved reuse
(the [rbtree](test/bench/koka/rbtree.kk) benchmark is faster as C++ now).
Improved effect operation speed. Allow elision of `->` in anonymous
Expand Down Expand Up @@ -163,7 +170,7 @@ This takes a while as it pre-compiles the standard libraries in three build
variants (`debug`, `drelease` (release with debug info), and `release`).
After generating the bundle, you can install it locally as:
```
$ util/install.sh -b bundle/koka-v2.3.1-linux-x64.tar.gz
$ util/install.sh bundle/koka-v2.3.1-linux-x64.tar.gz
```
(use `util/install.bat` on Windows).
After installation, you can now directly invoke `koka`:
Expand Down Expand Up @@ -255,17 +262,16 @@ More advanced projects:
typed [range map](src/Syntax/RangeMap.hs) so this should be managable. Partially done: see PR #100 (by @fwcd) -- it just
needs work on packaging it to make it easy to build and install as part of the Koka installer.
- [ ] Package management of Koka modules.
- [ ] Compile to WASM (using emscripten on the current C backend)
- [x] Compile to WASM (using emscripten on the current C backend)
- [ ] Extend TRMC to include (1) return results with pairs (like `unzip` or `partition`), (2) associative functions
(like `+` in `length`), and (3) mutually recursive functions.
- [ ] Improve compilation of local state to use local variables directly (in C) without allocation. Tricky though due to multiple resumptions.
- [ ] Improve performance of array/mutable reference programming. Koka is has great performance for
algebraic datatypes but lags when using more imperative array algorithms. This requires better
integration with the reference counting (faster in-place update for vectors) and integration local mutable references.
- [ ] To support optimal btree's we need mutable fields in constructors; or at least intrusive vector fields.
- [ ] To support optimal Btree's we need _mutable fields_ in constructors, and perhaps intrusive vector fields.
- [ ] The current parallel task support is very basic; we need a great work-stealing thread pool, LVar's etc.
- [ ] Expose the "bytes" primitive data together with views.
- [ ] Improve C backend code generation to generate nicer output with less "noise" (like temporary variables, or variables for each if condition etc).
- [ ] Expose the "bytes" primitive data together with views..
- [ ] Improve C code generation by identifying output that could be better; also in effectful code we generate many join-points (see [9]),
can we increase the sharing/reduce the extra code.
- [ ] The compiler always analyses module dependencies and builds any needed dependencies. The current code
Expand All @@ -274,7 +280,7 @@ More advanced projects:

Master/PhD level:

- [ ] Better FBIP support with guaranteed datatype matching, automatic derivative and visitor generation.
- [ ] Better language level FBIP support with guaranteed datatype matching, automatic derivative and visitor generation.
- [ ] Can we use C++ exceptions to implement "zero-cost" `if yielding() ...` branches and remove the need join points (see [9]).
- [x] Float up `open` calls to improve effect handling (worked on by Naoya Furudono)
- [x] Formalize opening and closing effect row types (worked on by Kazuki Ikemori)
Expand Down
2 changes: 1 addition & 1 deletion util/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends cmake \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
RUN git clone --recursive https://github.com/koka-lang/koka -b v2.3.1
RUN git clone --recursive https://github.com/koka-lang/koka -b v2.3.2
WORKDIR /build/koka
RUN stack build
RUN stack exec koka -- util/bundle -- --postfix=docker
Expand Down
96 changes: 65 additions & 31 deletions util/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rem Installation script for Koka; use -h to see command line options.
rem ------------------------------------------------------------------

setlocal
set KOKA_VERSION=v2.3.1
set KOKA_VERSION=v2.3.2
set KOKA_PREFIX=%LOCALAPPDATA%\koka
set KOKA_UNINSTALL=N
set KOKA_HELP=N
Expand All @@ -27,54 +27,88 @@ rem check if %LOCALAPPDATA% was not empty
if "%KOKA_PREFIX%" == "\koka" (set KOKA_PREFIX=c:\usr\local\koka)

rem process arguments
:argparse
if "%~1" == "" goto done_args
if "%~1" == "-u" (
:args_parse
set kk_flag=%1

if "%kk_flag%" == "" goto args_done
if "%kk_flag:~0,1%" == "-" goto args_flag

set KOKA_DIST_SOURCE=%~1
goto args_next

:args_flag
if "%kk_flag%" == "-u" (
set KOKA_UNINSTALL=Y
goto boolflag
goto args_next
)
if "%~1" == "--uninstall" (
if "%kk_flag%" == "--uninstall" (
set KOKA_UNINSTALL=Y
goto boolflag
goto args_next
)
if "%~1" == "-h" (
if "%kk_flag%" == "-h" (
set KOKA_HELP=Y
goto boolflag
goto args_next
)
if "%~1" == "--help" (
if "%kk_flag%" == "--help" (
set KOKA_HELP=Y
goto boolflag
goto args_next
)
if "%~1" == "-f" (
if "%kk_flag%" == "-f" (
set KOKA_FORCE=Y
goto boolflag
goto args_next
)
if "%~1" == "--force" (
if "%kk_flag%" == "--force" (
set KOKA_FORCE=Y
goto boolflag
goto args_next
)
if "%~1" == "--iexpress" (
if "%kk_flag%" == "--iexpress" (
set KOKA_IEXPRESS=Y
goto boolflag
goto args_next
)

if "%kk_flag%" == "--version" (
set KOKA_VERSION=%~2
goto args_next2
)
if "%kk_flag%" == "-p" (
set KOKA_PREFIX=%~2
goto args_next2
)
if "%kk_flag%" == "--prefix" (
set KOKA_PREFIX=%~2
goto args_next2
)
if "%~1" == "-v" (set KOKA_VERSION=%~2)
if "%~1" == "--version" (set KOKA_VERSION=%~2)
if "%~1" == "-p" (set KOKA_PREFIX=%~2)
if "%~1" == "--prefix" (set KOKA_PREFIX=%~2)
if "%~1" == "-b" (set KOKA_DIST_SOURCE=%~2)
if "%~1" == "--bundle" (set KOKA_DIST_SOURCE=%~2)
if "%~1" == "--url" (set KOKA_DIST_SOURCE_URL=%~2)
if "%kk_flag%" == "-b" (
set KOKA_DIST_SOURCE=%~2
goto args_next2
)
if "%kk_flag%" == "--bundle" (
set KOKA_DIST_SOURCE=%~2
goto args_next2
)
if "%kk_flag%" == "--url" (
set KOKA_DIST_SOURCE_URL=%~2
goto args_next2
)

echo unknown command line option: %kk_flag%
set KOKA_HELP=Y
goto args_next

:args_next2
shift
:boolflag
:args_next
shift
goto argparse
:done_args
goto args_parse
:args_done

rem ---------------------------------------------------------
rem Defaults
rem ---------------------------------------------------------

if "%KOKA_VERSION%" leq "v2.1.6" (set KOKA_ARCH=amd64)
if "%KOKA_VERSION:~0,1%" neq "v" set KOKA_VERSION=v%KOKA_VERSION%

if "%KOKA_VERSION%" leq "v2.1.6" set KOKA_ARCH=amd64

if "%KOKA_DIST_SOURCE_URL%" == "" (
set KOKA_DIST_SOURCE_URL=%KOKA_DIST_BASE_URL%/%KOKA_VERSION%/koka-%KOKA_VERSION%-windows-%KOKA_ARCH%.tar.gz
Expand Down Expand Up @@ -115,15 +149,15 @@ rem ---------------------------------------------------------
:help

echo command:
echo install-koka.bat [options]
echo install-koka.bat [options] [bundle file]
echo.
echo options:
echo -f, --force continue without prompting
echo -u, --uninstall uninstall koka (%KOKA_VERSION%)
echo -p, --prefix=^<dir^> prefix directory (%KOKA_PREFIX%)
echo -b, --bundle=^<file^|url^> full bundle location (%KOKA_DIST_SOURCE%)
echo --url=^<url^> download url (%KOKA_DIST_SOURCE_URL%)
echo --version=^<ver^> version tag (%KOKA_VERSION%)
echo --version=^<ver^> version tag (%KOKA_VERSION%)
rem echo -b, --bundle=^<file^|url^> full bundle location (%KOKA_DIST_SOURCE%)
echo.
goto end

Expand Down
20 changes: 13 additions & 7 deletions util/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Installation script for Koka; use -h to see command line options.
#-----------------------------------------------------------------------------

VERSION="v2.3.1"
VERSION="v2.3.2"
MODE="install" # or uninstall
PREFIX="/usr/local"
QUIET=""
Expand All @@ -20,7 +20,7 @@ KOKA_TEMP_DIR="" # empty creates one dynamically
adjust_version() { # <osarch>
case "$1" in
linux-arm64)
VERSION="v2.3.1";;
VERSION="v2.3.2";;
esac
}

Expand Down Expand Up @@ -144,20 +144,23 @@ process_options() {
PREFIX="$flag_arg";;
-u=*|--url=*)
KOKA_DIST_URL="$flag_arg";;
-b) shift
-b) shift
KOKA_DIST_SOURCE="$1";;
-b=*|--bundle=*)
KOKA_DIST_SOURCE="$flag_arg";;
-v) shift
VERSION="v${1#v}";; # always prefix with a v
VERSION="v${1#v}";; # always prefix with a v
-v=*|--version=*)
VERSION="v${flag_arg#v}";; # always prefix with a v
-u|--uninstall)
# FORCE="yes"
MODE="uninstall";;
-h|--help|-\?|help|\?)
MODE="help";;
*) warn "warning: unknown option \"$1\"."
*) case "$flag" in
-*) warn "warning: unknown option \"$1\".";;
*) KOKA_DIST_SOURCE="$1";;
esac;;
esac
shift
done
Expand Down Expand Up @@ -577,18 +580,21 @@ main_install() {

main_help() {
info "command:"
info " ./install.sh [options]"
info " ./install.sh [options] [bundle file]"
info ""
info "options:"
info " -q, --quiet suppress output"
info " -f, --force continue without prompting"
info " -u, --uninstall uninstall koka ($VERSION)"
info " -p, --prefix=<dir> prefix directory ($PREFIX)"
info " -b, --bundle=<file|url> full bundle location (.../koka-$VERSION-$OSARCH.tar.gz)"
# info " -b, --bundle=<file|url> full bundle location (.../koka-$VERSION-$OSARCH.tar.gz)"
info " --version=<ver> version tag ($VERSION)"
info " --url=<url> download url"
info " ($KOKA_DIST_URL)"
info ""
info "notes:"
info " the bundle file can optionally be given explicitly, e.g.: bundle/koka-$VERSION-$OSARCH.tar.gz"
info ""
}

main_start() {
Expand Down
2 changes: 1 addition & 1 deletion util/minbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# For use on platforms where stack is not working and to document
# the minimal needed commands to build the full compiler.

KOKA_VERSION=2.3.1
KOKA_VERSION=2.3.2
KOKA_VARIANT=release

echo ""
Expand Down

0 comments on commit 86b1ee9

Please sign in to comment.