├── .gitattributes ├── .github └── workflows │ └── bundle.yaml ├── .gitignore ├── .gitmodules ├── .valgrindrc ├── LICENSE ├── doc ├── bench-amd3600-nov-2020.png ├── koka.css ├── logo │ ├── koka-banner.png │ ├── koka-logo-100.png │ ├── koka-logo-200.png │ ├── koka-logo-400.png │ ├── koka-logo-filled.png │ ├── koka-logo-url.png │ ├── koka-logo-v2-100.png │ ├── koka-logo-v2-200.png │ ├── koka-logo-v2-400.png │ ├── koka-logo-v2-800.png │ ├── koka-logo.png │ └── logo.docx ├── rise4fun │ ├── guide.kk.md │ ├── guide.kkdoc │ └── risekoka.css ├── snippet-rbtree.png ├── snippet-yield.png ├── spec │ ├── arm64.json │ ├── book-style.md │ ├── book.kk.md │ ├── getstarted.kk.md │ ├── grammar │ │ ├── lexer.l │ │ ├── parser.y │ │ └── readme.md │ ├── ignores.dic │ ├── images │ │ ├── logo-alpine.svg │ │ ├── logo-arch.svg │ │ ├── logo-debian.svg │ │ ├── logo-freebsd.svg │ │ ├── penrose-tiling.png │ │ ├── perceus-perf-bw.png │ │ ├── perceus-perf.png │ │ ├── perceus3.jpg │ │ ├── vscode-caesar.png │ │ ├── vscode-codelens.png │ │ ├── vscode-commands.png │ │ ├── vscode-inlay-off.png │ │ ├── vscode-inlay-on.png │ │ ├── vscode-install-compiler.png │ │ ├── vscode-install.png │ │ └── vscode-rbtree.png │ ├── index.kk.md │ ├── install.mdk │ ├── koka.bib │ ├── koka.json │ ├── news.mdk │ ├── scripts │ │ └── book.js │ ├── spec.kk.md │ ├── styles │ │ ├── book.css │ │ ├── koka-logo.png │ │ ├── webanchors.mdk │ │ └── webtoc.mdk │ ├── tour.kk.md │ ├── unchecked.json │ └── why.kk.md └── system-logos.png ├── kklib ├── CMakeLists.txt ├── ide │ ├── vs2019 │ │ ├── kklib-test-effbayes.vcxproj │ │ ├── kklib-test-effbayes.vcxproj.filters │ │ ├── kklib-test-effbayes.vcxproj.user │ │ ├── kklib-test-interactive.vcxproj │ │ ├── kklib-test-interactive.vcxproj.filters │ │ ├── kklib-test-interactive.vcxproj.interactive │ │ ├── kklib-test-interactive.vcxproj.user │ │ ├── kklib-test.vcxproj │ │ ├── kklib-test.vcxproj.filters │ │ ├── kklib-test.vcxproj.user │ │ ├── kklib.natvis │ │ ├── kklib.sln │ │ ├── kklib.vcxproj │ │ ├── kklib.vcxproj.filters │ │ └── kklib.vcxproj.user │ └── vs2022 │ │ ├── kklib-test-effbayes.vcxproj │ │ ├── kklib-test-effbayes.vcxproj.filters │ │ ├── kklib-test-interactive.vcxproj │ │ ├── kklib-test-interactive.vcxproj.filters │ │ ├── kklib-test.vcxproj │ │ ├── kklib-test.vcxproj.filters │ │ ├── kklib.natvis │ │ ├── kklib.sln │ │ ├── kklib.vcxproj │ │ └── kklib.vcxproj.filters ├── include │ ├── kklib.h │ └── kklib │ │ ├── atomic.h │ │ ├── bits.h │ │ ├── box.h │ │ ├── bytes.h │ │ ├── integer.h │ │ ├── lazy.h │ │ ├── maybe.h │ │ ├── os.h │ │ ├── platform.h │ │ ├── process.h │ │ ├── random.h │ │ ├── ref.h │ │ ├── string.h │ │ ├── thread.h │ │ └── vector.h ├── src │ ├── all.c │ ├── bits.c │ ├── box.c │ ├── bytes.c │ ├── init.c │ ├── integer.c │ ├── lazy.c │ ├── os.c │ ├── process.c │ ├── random.c │ ├── ref.c │ ├── refcount.c │ ├── string.c │ ├── thread.c │ ├── time.c │ └── vector.c └── test │ ├── main.c │ ├── time.c │ └── time.h ├── koka.cabal ├── lib ├── package.std.json ├── std │ ├── async │ │ ├── file.kk │ │ └── readline.kk │ ├── core.kk │ ├── core │ │ ├── bool.kk │ │ ├── char.kk │ │ ├── console.kk │ │ ├── debug.kk │ │ ├── delayed.kk │ │ ├── either.kk │ │ ├── exn.kk │ │ ├── hnd.kk │ │ ├── inline │ │ │ ├── console.js │ │ │ ├── core.c │ │ │ ├── core.cs │ │ │ ├── core.h │ │ │ ├── debug.c │ │ │ ├── exn.c │ │ │ ├── exn.h │ │ │ ├── exn.js │ │ │ ├── hnd.c │ │ │ ├── hnd.h │ │ │ ├── hnd.js │ │ │ ├── int.h │ │ │ ├── int.js │ │ │ ├── sslice.c │ │ │ ├── sslice.h │ │ │ ├── sslice.js │ │ │ ├── string.c │ │ │ ├── string.h │ │ │ ├── string.js │ │ │ ├── types-cctx.c │ │ │ ├── types-cctx.h │ │ │ ├── types-cctx.js │ │ │ ├── types.js │ │ │ ├── vector.c │ │ │ ├── vector.h │ │ │ └── vector.js │ │ ├── int.kk │ │ ├── lazy.kk │ │ ├── list.kk │ │ ├── maybe.kk │ │ ├── maybe2.kk │ │ ├── order.kk │ │ ├── show.kk │ │ ├── sslice.kk │ │ ├── string.kk │ │ ├── tuple.kk │ │ ├── types.kk │ │ ├── undiv.kk │ │ ├── unsafe.kk │ │ └── vector.kk │ ├── data │ │ ├── array.kk │ │ ├── dict.kk │ │ ├── imap.kk │ │ ├── iset.kk │ │ ├── map.kk │ │ └── set.kk │ ├── num │ │ ├── ddouble.kk │ │ ├── decimal.kk │ │ ├── float64-inline.c │ │ ├── float64-inline.h │ │ ├── float64-inline.js │ │ ├── float64.kk │ │ ├── int32-inline.c │ │ ├── int32.kk │ │ ├── int64-inline.c │ │ ├── int64.kk │ │ ├── random-inline.js │ │ └── random.kk │ ├── os │ │ ├── dir-inline.c │ │ ├── dir.kk │ │ ├── env.kk │ │ ├── file-inline.c │ │ ├── file-inline.js │ │ ├── file.kk │ │ ├── flags.kk │ │ ├── null.kk │ │ ├── path-inline.cs │ │ ├── path-inline.js │ │ ├── path.kk │ │ ├── process-inline.c │ │ ├── process.kk │ │ ├── readline-inline.c │ │ ├── readline-inline.js │ │ ├── readline.kk │ │ └── task.kk │ ├── text │ │ ├── parse.kk │ │ ├── regex-inline.c │ │ ├── regex-inline.cs │ │ ├── regex-inline.js │ │ ├── regex.kk │ │ ├── unicode-inline.cs │ │ ├── unicode-inline.js │ │ └── unicode.kk │ ├── time.kk │ └── time │ │ ├── astro.kk │ │ ├── calendar-inline.c │ │ ├── calendar-inline.cs │ │ ├── calendar-inline.js │ │ ├── calendar.kk │ │ ├── calendars.kk │ │ ├── chrono-inline.c │ │ ├── chrono-inline.cs │ │ ├── chrono-inline.js │ │ ├── chrono.kk │ │ ├── date.kk │ │ ├── download.kk │ │ ├── duration.kk │ │ ├── format.kk │ │ ├── instant.kk │ │ ├── locale.kk │ │ ├── parse.kk │ │ ├── time.kk │ │ ├── timer-inline.c │ │ ├── timer-inline.cs │ │ ├── timer-inline.js │ │ ├── timer.kk │ │ ├── timescales.png │ │ ├── timestamp.kk │ │ ├── timezone-inline.js │ │ ├── timezone.kk │ │ ├── ut1.kk │ │ └── utc.kk ├── toc.kk └── v1 │ ├── demo │ ├── chatbot.kk │ ├── collatz.kk │ ├── dom │ │ ├── conway.kk │ │ ├── flyingDivs.kk │ │ ├── microsoftLogo.kk │ │ ├── starfield.kk │ │ └── tile.kk │ ├── fib.kk │ ├── garsiaWachs.kk │ ├── node │ │ ├── chatMoebius.kk │ │ └── chatRpc.kk │ └── nqueens.kk │ └── std │ ├── async-inline.cs │ ├── async-inline.js │ ├── async.kk │ ├── crypto-inline.cs │ ├── crypto-inline.js │ ├── crypto.kk │ ├── data │ ├── array.kk │ ├── dict-inline.js │ └── dict.kk │ ├── log.kk │ ├── net │ ├── http-inline.js │ └── http.kk │ ├── os │ ├── file-inline.cs │ ├── file-inline.js │ ├── file.kk │ ├── readline-inline.cs │ ├── readline-inline.js │ └── readline.kk │ ├── sys │ ├── dom.kk │ ├── dom │ │ ├── anonXmlHttpRequest.kk │ │ ├── attr.kk │ │ ├── booleanArray.kk │ │ ├── byteArray.kk │ │ ├── caretPosition.kk │ │ ├── characterData.kk │ │ ├── comment.kk │ │ ├── css │ │ │ ├── counter.kk │ │ │ ├── css2Properties.kk │ │ │ ├── cssCharsetRule.kk │ │ │ ├── cssColorComponentValue.kk │ │ │ ├── cssComponentValue.kk │ │ │ ├── cssFontFaceRule.kk │ │ │ ├── cssIdentifierComponentValue.kk │ │ │ ├── cssImportRule.kk │ │ │ ├── cssKeywordComponentValue.kk │ │ │ ├── cssLengthComponentValue.kk │ │ │ ├── cssMapValue.kk │ │ │ ├── cssMediaRule.kk │ │ │ ├── cssNamespaceRule.kk │ │ │ ├── cssPageRule.kk │ │ │ ├── cssPercentageComponentValue.kk │ │ │ ├── cssPrimitiveValue.kk │ │ │ ├── cssPropertyValue.kk │ │ │ ├── cssPropertyValueList.kk │ │ │ ├── cssRule.kk │ │ │ ├── cssStringComponentValue.kk │ │ │ ├── cssStyleDeclaration.kk │ │ │ ├── cssStyleDeclarationValue.kk │ │ │ ├── cssStyleRule.kk │ │ │ ├── cssStyleSheet.kk │ │ │ ├── cssUnknownRule.kk │ │ │ ├── cssUrlComponentValue.kk │ │ │ ├── cssValue.kk │ │ │ ├── cssValueList.kk │ │ │ ├── documentCss.kk │ │ │ ├── domImplementationCss.kk │ │ │ ├── elementCssInlineStyle.kk │ │ │ ├── rect.kk │ │ │ └── rgbColor.kk │ │ ├── document.kk │ │ ├── documentFragment.kk │ │ ├── documentType.kk │ │ ├── domElementMap.kk │ │ ├── domException.kk │ │ ├── domImplementation.kk │ │ ├── domSettableTokenList.kk │ │ ├── domStringList.kk │ │ ├── domStringMap.kk │ │ ├── domTokenList.kk │ │ ├── doubleArray.kk │ │ ├── element.kk │ │ ├── events │ │ │ ├── compositionEvent.kk │ │ │ ├── customEvent.kk │ │ │ ├── customEventInit.kk │ │ │ ├── event.kk │ │ │ ├── eventException.kk │ │ │ ├── eventInit.kk │ │ │ ├── eventListener.kk │ │ │ ├── eventTarget.kk │ │ │ ├── focusEvent.kk │ │ │ ├── keyboardEvent.kk │ │ │ ├── mouseEvent.kk │ │ │ ├── mutationEvent.kk │ │ │ ├── mutationNameEvent.kk │ │ │ ├── progressEvent.kk │ │ │ ├── textEvent.kk │ │ │ ├── uiEvent.kk │ │ │ └── wheelEvent.kk │ │ ├── eventsource │ │ │ └── eventSource.kk │ │ ├── file │ │ │ ├── blob.kk │ │ │ ├── file.kk │ │ │ ├── fileCallback.kk │ │ │ ├── fileError.kk │ │ │ ├── fileException.kk │ │ │ ├── fileList.kk │ │ │ ├── fileReader.kk │ │ │ └── fileReaderSync.kk │ │ ├── floatArray.kk │ │ ├── formData.kk │ │ ├── html │ │ │ ├── applicationCache.kk │ │ │ ├── audioTrack.kk │ │ │ ├── audioTrackList.kk │ │ │ ├── barProp.kk │ │ │ ├── beforeUnloadEvent.kk │ │ │ ├── blobCallback.kk │ │ │ ├── canvasGradient.kk │ │ │ ├── canvasPattern.kk │ │ │ ├── canvasPixelArray.kk │ │ │ ├── canvasRenderingContext2d.kk │ │ │ ├── dataTransfer.kk │ │ │ ├── dataTransferItem.kk │ │ │ ├── dataTransferItemList.kk │ │ │ ├── dragEvent.kk │ │ │ ├── external_.kk │ │ │ ├── function.kk │ │ │ ├── functionStringCallback.kk │ │ │ ├── hashChangeEvent.kk │ │ │ ├── history.kk │ │ │ ├── htmlAllCollection.kk │ │ │ ├── htmlAnchorElement.kk │ │ │ ├── htmlAppletElement.kk │ │ │ ├── htmlAreaElement.kk │ │ │ ├── htmlAudioElement.kk │ │ │ ├── htmlBaseElement.kk │ │ │ ├── htmlBaseFontElement.kk │ │ │ ├── htmlBodyElement.kk │ │ │ ├── htmlBrElement.kk │ │ │ ├── htmlButtonElement.kk │ │ │ ├── htmlCanvasElement.kk │ │ │ ├── htmlCollection.kk │ │ │ ├── htmlCommandElement.kk │ │ │ ├── htmlDListElement.kk │ │ │ ├── htmlDataListElement.kk │ │ │ ├── htmlDetailsElement.kk │ │ │ ├── htmlDirectoryElement.kk │ │ │ ├── htmlDivElement.kk │ │ │ ├── htmlDocument.kk │ │ │ ├── htmlElement.kk │ │ │ ├── htmlEmbedElement.kk │ │ │ ├── htmlFieldSetElement.kk │ │ │ ├── htmlFontElement.kk │ │ │ ├── htmlFormControlsCollection.kk │ │ │ ├── htmlFormElement.kk │ │ │ ├── htmlFrameElement.kk │ │ │ ├── htmlFrameSetElement.kk │ │ │ ├── htmlHeadElement.kk │ │ │ ├── htmlHeadingElement.kk │ │ │ ├── htmlHrElement.kk │ │ │ ├── htmlHtmlElement.kk │ │ │ ├── htmlIframeElement.kk │ │ │ ├── htmlImageElement.kk │ │ │ ├── htmlInputElement.kk │ │ │ ├── htmlKeygenElement.kk │ │ │ ├── htmlLabelElement.kk │ │ │ ├── htmlLegendElement.kk │ │ │ ├── htmlLiElement.kk │ │ │ ├── htmlLinkElement.kk │ │ │ ├── htmlMapElement.kk │ │ │ ├── htmlMarqueeElement.kk │ │ │ ├── htmlMediaElement.kk │ │ │ ├── htmlMenuElement.kk │ │ │ ├── htmlMetaElement.kk │ │ │ ├── htmlMeterElement.kk │ │ │ ├── htmlModElement.kk │ │ │ ├── htmlOListElement.kk │ │ │ ├── htmlObjectElement.kk │ │ │ ├── htmlOptGroupElement.kk │ │ │ ├── htmlOptionElement.kk │ │ │ ├── htmlOptionsCollection.kk │ │ │ ├── htmlOutputElement.kk │ │ │ ├── htmlParagraphElement.kk │ │ │ ├── htmlParamElement.kk │ │ │ ├── htmlPreElement.kk │ │ │ ├── htmlProgressElement.kk │ │ │ ├── htmlPropertiesCollection.kk │ │ │ ├── htmlQuoteElement.kk │ │ │ ├── htmlScriptElement.kk │ │ │ ├── htmlSelectElement.kk │ │ │ ├── htmlSourceElement.kk │ │ │ ├── htmlSpanElement.kk │ │ │ ├── htmlStyleElement.kk │ │ │ ├── htmlTableCaptionElement.kk │ │ │ ├── htmlTableCellElement.kk │ │ │ ├── htmlTableColElement.kk │ │ │ ├── htmlTableDataCellElement.kk │ │ │ ├── htmlTableElement.kk │ │ │ ├── htmlTableHeaderCellElement.kk │ │ │ ├── htmlTableRowElement.kk │ │ │ ├── htmlTableSectionElement.kk │ │ │ ├── htmlTextAreaElement.kk │ │ │ ├── htmlTimeElement.kk │ │ │ ├── htmlTitleElement.kk │ │ │ ├── htmlTrackElement.kk │ │ │ ├── htmlUListElement.kk │ │ │ ├── htmlUnknownElement.kk │ │ │ ├── htmlVideoElement.kk │ │ │ ├── imageData.kk │ │ │ ├── localMediaStream.kk │ │ │ ├── location.kk │ │ │ ├── mediaController.kk │ │ │ ├── mediaError.kk │ │ │ ├── mediaQueryList.kk │ │ │ ├── mediaQueryListListener.kk │ │ │ ├── mediaStream.kk │ │ │ ├── mediaStreamRecorder.kk │ │ │ ├── messageChannel.kk │ │ │ ├── messageEvent.kk │ │ │ ├── messagePort.kk │ │ │ ├── mutableTextTrack.kk │ │ │ ├── navigator.kk │ │ │ ├── navigatorUserMediaError.kk │ │ │ ├── navigatorUserMediaErrorCallback.kk │ │ │ ├── navigatorUserMediaSuccessCallback.kk │ │ │ ├── pageTransitionEvent.kk │ │ │ ├── peerConnection.kk │ │ │ ├── popStateEvent.kk │ │ │ ├── propertyNodeList.kk │ │ │ ├── radioNodeList.kk │ │ │ ├── screen.kk │ │ │ ├── signalingCallback.kk │ │ │ ├── streamEvent.kk │ │ │ ├── streamTrack.kk │ │ │ ├── textMetrics.kk │ │ │ ├── textTrack.kk │ │ │ ├── textTrackCue.kk │ │ │ ├── textTrackCueList.kk │ │ │ ├── timeRanges.kk │ │ │ ├── transferable.kk │ │ │ ├── undoManager.kk │ │ │ ├── undoManagerEvent.kk │ │ │ ├── validityState.kk │ │ │ ├── videoTrack.kk │ │ │ ├── videoTrackList.kk │ │ │ ├── window.kk │ │ │ └── windowModal.kk │ │ ├── longArray.kk │ │ ├── longLongArray.kk │ │ ├── node.kk │ │ ├── nodeList.kk │ │ ├── octetArray.kk │ │ ├── processingInstruction.kk │ │ ├── ranges │ │ │ ├── documentRange.kk │ │ │ ├── range.kk │ │ │ └── rangeException.kk │ │ ├── shortArray.kk │ │ ├── stylesheets │ │ │ ├── linkStyle.kk │ │ │ ├── mediaList.kk │ │ │ └── styleSheet.kk │ │ ├── text.kk │ │ ├── traversal │ │ │ ├── documentTraversal.kk │ │ │ ├── nodeFilter.kk │ │ │ ├── nodeIterator.kk │ │ │ └── treeWalker.kk │ │ ├── typedarray │ │ │ ├── arrayBuffer.kk │ │ │ ├── arrayBufferView.kk │ │ │ ├── dataView.kk │ │ │ ├── float32Array.kk │ │ │ ├── float64Array.kk │ │ │ ├── int16Array.kk │ │ │ ├── int32Array.kk │ │ │ ├── int8Array.kk │ │ │ ├── uint16Array.kk │ │ │ ├── uint32Array.kk │ │ │ └── uint8Array.kk │ │ ├── types.kk │ │ ├── unsignedByteArray.kk │ │ ├── unsignedLongArray.kk │ │ ├── unsignedLongLongArray.kk │ │ ├── unsignedShortArray.kk │ │ ├── views │ │ │ ├── clientRect.kk │ │ │ └── clientRectList.kk │ │ ├── xmlHttpRequest.kk │ │ ├── xmlHttpRequestEventTarget.kk │ │ └── xmlHttpRequestUpload.kk │ └── node │ │ ├── tiersplit-inline.js │ │ └── tiersplit.kk │ └── text │ ├── atom-inline.cs │ ├── atom-inline.js │ ├── atom.kk │ └── string.kk ├── package.yaml ├── readme.md ├── samples ├── all.kk ├── basic │ ├── caesar.kk │ ├── fibonacci.kk │ ├── garsia-wachs.kk │ ├── rbtree-fbip.kk │ ├── rbtree.cpp │ └── rbtree.kk ├── handlers │ ├── ambient.kk │ ├── basic.kk │ ├── named │ │ ├── ask-poly.kk │ │ ├── ask.kk │ │ ├── file-scoped.kk │ │ ├── file.kk │ │ ├── heap.kk │ │ └── unify.kk │ ├── nim.kk │ ├── parser.kk │ ├── scoped.kk │ ├── unix.kk │ ├── vec.kk │ └── yield.kk ├── learn │ ├── basic.kk │ ├── contexts.kk │ ├── fip.kk │ ├── handler.kk │ ├── implicits.kk │ ├── lazycons.kk │ ├── qualifiers.kk │ └── with.kk └── readme.md ├── src ├── Backend │ ├── C │ │ ├── Box.hs │ │ ├── FromCore.hs │ │ ├── Parc.hs │ │ ├── ParcReuse.hs │ │ └── ParcReuseSpec.hs │ ├── CSharp │ │ └── FromCore.hs │ └── JavaScript │ │ └── FromCore.hs ├── Common │ ├── ColorScheme.hs │ ├── Error.hs │ ├── Failure.hs │ ├── File.hs │ ├── Id.hs │ ├── IdMap.hs │ ├── IdNice.hs │ ├── IdSet.hs │ ├── Message.hs │ ├── Name.hs │ ├── NameMap.hs │ ├── NamePrim.hs │ ├── NameSet.hs │ ├── QNameMap.hs │ ├── Range.hs │ ├── ResumeKind.hs │ ├── Syntax.hs │ └── Unique.hs ├── Compile │ ├── Build.hs │ ├── BuildContext.hs │ ├── CodeGen.hs │ ├── Module.hs │ ├── Optimize.hs │ ├── Options.hs │ ├── Package.hs │ └── TypeCheck.hs ├── Core │ ├── AnalysisCCtx.hs │ ├── AnalysisMatch.hs │ ├── AnalysisResume.hs │ ├── BindingGroups.hs │ ├── Borrowed.hs │ ├── CTail.hs │ ├── Check.hs │ ├── CheckFBIP.hs │ ├── Core.hs │ ├── CoreVar.hs │ ├── Divergent.hs │ ├── FunLift.hs │ ├── Inline.hs │ ├── Inlines.hs │ ├── Monadic.hs │ ├── MonadicLift.hs │ ├── OpenResolve.hs │ ├── Parse.hs │ ├── Pretty.hs │ ├── Simplify.hs │ ├── Specialize.hs │ ├── UnReturn.hs │ ├── Uniquefy.hs │ └── Unroll.hs ├── Interpreter │ ├── Command.hs │ └── Interpret.hs ├── Kind │ ├── Assumption.hs │ ├── Constructors.hs │ ├── ImportMap.hs │ ├── Infer.hs │ ├── InferKind.hs │ ├── InferMonad.hs │ ├── Kind.hs │ ├── Newtypes.hs │ ├── Pretty.hs │ ├── Repr.hs │ ├── Synonym.hs │ └── Unify.hs ├── Lib │ ├── JSON.hs │ ├── PPrint.hs │ ├── Printer.hs │ ├── Scc.hs │ └── Trace.hs ├── Main │ ├── README.md │ ├── Run.hs │ ├── langserver │ │ ├── LanguageServer │ │ │ ├── Conversions.hs │ │ │ ├── Handler │ │ │ │ ├── CodeAction.hs │ │ │ │ ├── Commands.hs │ │ │ │ ├── Completion.hs │ │ │ │ ├── Definition.hs │ │ │ │ ├── DocumentSymbol.hs │ │ │ │ ├── Folding.hs │ │ │ │ ├── Hover.hs │ │ │ │ ├── InlayHints.hs │ │ │ │ ├── Pretty.hs │ │ │ │ ├── SignatureHelp.hs │ │ │ │ └── TextDocument.hs │ │ │ ├── Handlers.hs │ │ │ ├── Monad.hs │ │ │ └── Run.hs │ │ └── Main.hs │ └── plain │ │ └── Main.hs ├── Platform │ ├── cpp │ │ └── Platform │ │ │ ├── Config.hs │ │ │ ├── Console.hs │ │ │ ├── Filetime.hs │ │ │ ├── GetOptions.hs │ │ │ ├── ReadLine.hs │ │ │ ├── Runtime.hs │ │ │ ├── Var.hs │ │ │ ├── cconsole.c │ │ │ └── cconsole.h │ ├── haddock │ │ └── Platform │ │ │ ├── Config.hs │ │ │ ├── Console.hs │ │ │ ├── GetOptions.hs │ │ │ ├── ReadLine.hs │ │ │ ├── Runtime.hs │ │ │ └── Var.hs │ └── hugs │ │ └── Platform │ │ ├── Config.hs │ │ ├── Console.hs │ │ ├── Filetime.hs │ │ ├── GetOptions.hs │ │ ├── ReadLine.hs │ │ ├── Runtime.hs │ │ └── Var.hs ├── Static │ ├── BindingGroups.hs │ └── FixityResolve.hs ├── Syntax │ ├── Colorize.hs │ ├── GenDoc.hs │ ├── Highlight.hs │ ├── Layout.hs │ ├── Lexeme.hs │ ├── Lexer.x │ ├── Parse.hs │ ├── Pretty.hs │ ├── Promote.hs │ ├── RangeMap.hs │ └── Syntax.hs └── Type │ ├── Assumption.hs │ ├── InfGamma.hs │ ├── Infer.hs │ ├── InferMonad.hs │ ├── Kind.hs │ ├── Operations.hs │ ├── Pretty.hs │ ├── Type.hs │ ├── TypeVar.hs │ └── Unify.hs ├── stack.yaml ├── support ├── atom │ ├── grammars │ │ └── koka.json │ ├── package.json │ ├── settings │ │ └── language-koka.cson │ └── styles │ │ └── koka.less ├── emacs │ └── koka-mode.el ├── markdown │ └── markedxmp.js ├── pygments │ └── koka.py ├── sublime-text │ ├── Color Scheme - Default │ │ └── Snow.tmTheme │ ├── Jake-Haskell.sublime-build │ ├── Koka │ │ ├── Comments.tmPreferences │ │ ├── for.tmSnippet │ │ ├── foreach.tmSnippet │ │ ├── fun.tmSnippet │ │ ├── function.tmSnippet │ │ ├── if.tmSnippet │ │ ├── ife.tmSnippet │ │ ├── koka.JSON-tmLanguage │ │ ├── koka.sublime-settings │ │ ├── koka.tmLanguage │ │ ├── kokadoc.JSON-tmLanguage │ │ ├── kokadoc.sublime-settings │ │ ├── kokadoc.tmLanguage │ │ ├── main.tmSnippet │ │ ├── map.tmSnippet │ │ ├── match.tmSnippet │ │ ├── repeat.tmSnippet │ │ ├── struct.tmSnippet │ │ ├── type.tmSnippet │ │ ├── val.tmSnippet │ │ ├── var.tmSnippet │ │ └── while.tmSnippet │ └── readme.md ├── vim │ ├── README.md │ ├── ftdetect │ │ └── koka.vim │ ├── ftplugin │ │ └── koka.vim │ ├── indent │ │ └── koka.vim │ └── syntax │ │ └── koka.vim └── vscode │ ├── README.md │ └── koka.language-koka │ ├── LICENSE.md │ ├── README.md │ ├── images │ ├── codelens.png │ ├── impliciteq.png │ ├── inlayhints-off.png │ ├── inlayhints.png │ ├── koka-logo-filled-dark.svg │ ├── koka-logo-filled-light.svg │ ├── koka-logo-filled.png │ └── koka-logo-filled.svg │ ├── koka-configuration.json │ ├── package.json │ ├── src │ ├── code-lens.ts │ ├── debugger.ts │ ├── extension.ts │ ├── lang-server.ts │ └── workspace.ts │ ├── syntaxes │ └── koka.json │ ├── tsconfig.json │ └── webpack.config.js ├── test ├── Spec.hs ├── algeff │ ├── common.kk │ ├── config.json │ ├── cps-cgen1.kk │ ├── cps-cgen1a.kk │ ├── cps1.kk │ ├── cps1.kk.out │ ├── cps2.kk │ ├── cps2.kk.out │ ├── cps3.kk │ ├── cps3.kk.out │ ├── cps4.kk │ ├── cps4.kk.out │ ├── cps5.kk │ ├── cps5.kk.out │ ├── diverge.kk │ ├── eff-constant.kk │ ├── eff-constant.kk.out │ ├── eff-constant2.kk │ ├── eff-constant2.kk.out │ ├── eff-poly1.kk │ ├── eff-poly2.kk │ ├── eff-rec2.kk │ ├── eff-rec2.kk.out │ ├── effs-exists1.kk │ ├── effs-exists2.kk │ ├── effs-exists3.kk │ ├── effs1.kk │ ├── effs1.kk.out │ ├── effs1a.kk │ ├── effs1a.kk.out │ ├── effs1b.kk │ ├── effs1b.kk.out │ ├── effs2.kk │ ├── effs2.kk.out │ ├── effs3.kk │ ├── effs3.kk.out │ ├── effs3b.kk │ ├── effs3b.kk.out │ ├── effs3c.kk │ ├── effs3c.kk.out │ ├── effs4.kk │ ├── effs4.kk.out │ ├── effs5.kk │ ├── effs5.kk.out │ ├── effs5a.kk │ ├── exn1.kk │ ├── exn1.kk.out │ ├── exn2.kk │ ├── exn2.kk.out │ ├── exn3.kk │ ├── exn3.kk.out │ ├── expr.kk │ ├── expr.kk.out │ ├── finalize1.kk │ ├── implicits.kk │ ├── implicits.kk.out │ ├── issue305.kk │ ├── issue305.kk.out │ ├── linear1.kk │ ├── linear1.kk.out │ ├── linear2.kk │ ├── linear2.kk.out │ ├── linear3.kk │ ├── linear3.kk.out │ ├── mask1.kk │ ├── mask1.kk.out │ ├── match-error.kk │ ├── match-error.kk.out │ ├── mon-amb2.kk │ ├── muniq.kk │ ├── named-heap-shallow.kk │ ├── nim.kk │ ├── nim.kk.out │ ├── nim1a.kk │ ├── noyield1.kk │ ├── noyield1.kk.out │ ├── noyield2.kk │ ├── noyield2.kk.out │ ├── open1.kk │ ├── open1.kk.out │ ├── open1a.kk │ ├── open1a.kk.out │ ├── open2.kk │ ├── open2.kk.out │ ├── open3.kk │ ├── open3.kk.out │ ├── open3a.kk │ ├── open4.kk │ ├── open4a.kk │ ├── parser.kk │ ├── parser.kk.out │ ├── perf1-inline1.js │ ├── perf1.kk │ ├── perf1.kk.flags │ ├── perf1a.kk │ ├── perf1a.kk.flags │ ├── perf1b.kk │ ├── perf1c.kk │ ├── perf1d.kk │ ├── perf1e.kk │ ├── perf2.kk │ ├── perf2.kk.flags │ ├── perf2.kk.out │ ├── rcontrol1.kk │ ├── rcontrol1.kk.out │ ├── scheduler1.kk │ ├── scoped.flags │ ├── scoped.kk │ ├── scoped.kk.flags │ ├── scoped.kk.out │ ├── scoped2.kk │ ├── scoped2.kk.out │ ├── shallow1.kk │ ├── shallow1.kk.out │ ├── svars1.kk │ └── wrong │ │ ├── eff-rec1.kk │ │ ├── eff-rec1.kk.out │ │ ├── eff-rec1.out │ │ ├── eff-rec2.kk │ │ ├── eff-rec2.kk.out │ │ ├── eff-rec3.kk │ │ ├── eff-rec3.kk.out │ │ ├── eff-rec4.kk │ │ ├── eff-rec4.kk.out │ │ ├── eff-rec5.kk │ │ ├── eff-rec5.kk.out │ │ ├── eff-rec6.kk │ │ ├── eff-rec6.kk.out │ │ ├── linear1.kk │ │ ├── linear1.kk.out │ │ ├── linear2.kk │ │ ├── linear2.kk.out │ │ ├── mask1.kk │ │ ├── mask1.kk.out │ │ ├── ops1.kk │ │ ├── ops1.kk.out │ │ ├── ops2.kk │ │ ├── ops2.kk.out │ │ ├── ops4.kk │ │ ├── ops4.kk.out │ │ ├── ops5.kk │ │ ├── ops5.kk.out │ │ ├── reject-mono.kk │ │ ├── reject-poly.kk │ │ ├── reject-poly2.kk │ │ ├── reject-poly3.kk │ │ ├── scoped1.kk │ │ ├── scoped1.kk.out │ │ ├── type1.kk │ │ └── type1.kk.out ├── async │ ├── async-cancel1.kk │ ├── async-cancel2.kk │ ├── async-cancel2a.kk │ ├── async-cancel3.kk │ ├── async-cancel3a.kk │ ├── async-promise1.kk │ ├── async1.kk │ ├── async1.kk.out │ ├── async1a.kk │ ├── async2.kk │ ├── async2.kk.out │ ├── async3.kk │ ├── async3.kk.out │ ├── async3a.kk │ ├── async4.kk │ ├── async4.kk.out │ ├── async4a.kk │ ├── async4a.kk.out │ ├── async4b.kk │ ├── async4b.kk.out │ ├── async5.kk │ ├── async5.kk.out │ ├── async5a.kk │ ├── async5b.kk │ ├── async5c.kk │ ├── async5d.kk │ ├── async6.kk │ ├── async6.kk.out │ ├── async7.kk │ ├── async7.kk.out │ └── config.json ├── bayes │ ├── bayes.html │ └── bayes.kk ├── bench │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Dockerfile │ ├── README.md │ ├── bench.kk │ ├── cpp │ │ ├── CMakeLists.txt │ │ ├── binarytrees.cpp │ │ ├── binarytrees2.c │ │ ├── binarytrees3.c │ │ ├── binarytrees3.cpp │ │ ├── binarytrees4.cpp │ │ ├── binarytrees5.cpp │ │ ├── binarytrees7.cpp │ │ ├── binarytrees9.cpp │ │ ├── cfold.cpp │ │ ├── deriv.cpp │ │ ├── nqueens.cpp │ │ ├── rbtree-ck.cpp │ │ ├── rbtree-del.cpp │ │ └── rbtree.cpp │ ├── haskell │ │ ├── CMakeLists.txt │ │ ├── binarytrees.hs │ │ ├── cfold.hs │ │ ├── deriv.hs │ │ ├── nqueens.hs │ │ ├── qsort.hs │ │ ├── rbtree-ck.hs │ │ ├── rbtree-del.hs │ │ ├── rbtree.hs │ │ └── rbtree2.hs │ ├── intbench.sh │ ├── java │ │ ├── CMakeLists.txt │ │ ├── binarytrees.java │ │ ├── cfold.java │ │ ├── deriv.java │ │ ├── nqueens.java │ │ ├── rbtree.java │ │ └── rbtreeck.java │ ├── koka │ │ ├── CMakeLists.txt │ │ ├── binarytrees-fbip.kk │ │ ├── binarytrees.kk │ │ ├── binarytrees32.kk │ │ ├── borrowlist.kk │ │ ├── cfold.kk │ │ ├── counter-int.kk │ │ ├── counter.kk │ │ ├── counter1.kk │ │ ├── counter10.kk │ │ ├── deriv.kk │ │ ├── hamming-int.kk │ │ ├── hamming.kk │ │ ├── kkfree.kk │ │ ├── lookup-borrow.kk │ │ ├── lookup-owned.kk │ │ ├── mstate-int.kk │ │ ├── mstate.kk │ │ ├── nqueens-int.kk │ │ ├── nqueens.kk │ │ ├── pyth-int.kk │ │ ├── pyth.kk │ │ ├── rbtree-ck.kk │ │ ├── rbtree-del.kk │ │ ├── rbtree-del32.kk │ │ ├── rbtree-fbip-ck.kk │ │ ├── rbtree-fbip.kk │ │ ├── rbtree-int.kk │ │ ├── rbtree-poly.kk │ │ ├── rbtree.kk │ │ ├── rbtreex.kk │ │ ├── sfib-int.kk │ │ ├── sfib.kk │ │ ├── tak-int.kk │ │ └── tak.kk │ ├── lean │ │ ├── deriv.lean │ │ ├── leancompile.sh │ │ ├── rbtree-ck.lean │ │ ├── rbtree.lean │ │ └── rbtree4.lean │ ├── ocaml │ │ ├── CMakeLists.txt │ │ ├── binarytrees.ml │ │ ├── binarytrees_mc.ml │ │ ├── binarytrees_nomc.ml │ │ ├── cfold.ml │ │ ├── deriv.ml │ │ ├── nqueens.ml │ │ ├── qsort.ml │ │ ├── rbtree-ck.ml │ │ ├── rbtree-del.ml │ │ └── rbtree.ml │ ├── readme-icfp22.txt.md │ ├── readme-pldi40.txt.md │ └── swift │ │ ├── CMakeLists.txt │ │ ├── binarytrees.swift │ │ ├── cfold.swift │ │ ├── deriv.swift │ │ ├── nqueens.swift │ │ ├── qsort.swift │ │ ├── rbtree-ck.swift │ │ └── rbtree.swift ├── cgen │ ├── apply1.kk │ ├── assign1.kk │ ├── assign1.kk.out │ ├── box-int8.kk │ ├── box-int8.kk.out │ ├── box1.kk │ ├── box2.kk │ ├── box3.kk │ ├── box3a.kk │ ├── box4.kk │ ├── box4.kk.out │ ├── code1.kk │ ├── code2.kk │ ├── comments1.kk │ ├── comments1.kk.out │ ├── config.json │ ├── ctail-tree.kk │ ├── ctail1.kk │ ├── ctail10.kk │ ├── ctail11.kk │ ├── ctail11.kk.out │ ├── ctail11a.kk │ ├── ctail11a.kk.out │ ├── ctail1a.kk │ ├── ctail2.kk │ ├── ctail2a.kk │ ├── ctail3.kk │ ├── ctail3a.kk │ ├── ctail3b.kk │ ├── ctail4.kk │ ├── ctail5.kk │ ├── ctail5a.kk │ ├── ctail6.kk │ ├── ctail7a.kk │ ├── ctail7a.kk.out │ ├── ctail7b.kk │ ├── ctail7b.kk.out │ ├── ctail7c.kk │ ├── ctail7c.kk.out │ ├── ctail8.kk │ ├── ctail8.kk.out │ ├── ctail9.kk │ ├── data1.kk │ ├── dep1.kk │ ├── dep1.kk.out │ ├── dep2.kk │ ├── dep2.kk.out │ ├── eff-name.kk │ ├── eff-name.kk.out │ ├── effect1.kk │ ├── exists1.kk │ ├── external1.kk │ ├── external2.kk │ ├── external3.kk │ ├── external4.kk │ ├── field1.kk │ ├── field1.kk.out │ ├── fmaybe.kk │ ├── hidden1.kk │ ├── hidden2.kk │ ├── higherkind0.kk │ ├── higherkind0.kk.out │ ├── higherkind1.kk │ ├── higherkind1.kk.out │ ├── higherkind2.kk │ ├── higherkind2.kk.out │ ├── higherkind3.kk │ ├── host.kk │ ├── host.kk.out │ ├── inline1.kk │ ├── inline2.kk │ ├── inline3.kk │ ├── inline4.kk │ ├── javascript.kk │ ├── javascript.kk.out │ ├── lift2.kk │ ├── localrec1.kk │ ├── monad1.kk │ ├── monadic1.kk │ ├── monadic2.kk │ ├── monoid1.kk │ ├── monoid2.kk │ ├── mutual1.kk │ ├── mutual1.kk.out │ ├── open0.kk │ ├── open1.kk │ ├── open1.kk.out │ ├── open1a.kk │ ├── open2.kk │ ├── open3.kk │ ├── open4.kk │ ├── open4.kk.out │ ├── pat1.kk │ ├── rec1.kk │ ├── rec1.kk.out │ ├── rec2.kk │ ├── rec2.kk.out │ ├── rec3.kk │ ├── rec3.kk.out │ ├── rec4.kk │ ├── rec4.kk.out │ ├── rec4a.kk │ ├── rec4a.kk.out │ ├── rec5.kk │ ├── rec5.kk.out │ ├── return1.kk │ ├── return1.kk.out │ ├── return2.kk │ ├── return2.kk.out │ ├── return3.kk │ ├── return3.kk.out │ ├── return4.kk │ ├── return4.kk.out │ ├── return5.kk │ ├── return5.kk.out │ ├── return6.kk │ ├── return6.kk.out │ ├── returnscrut.kk │ ├── returnscrut.kk.out │ ├── reused-names.kk │ ├── reused-names.kk.out │ ├── shortcircuit1.kk │ ├── shortcircuit1.kk.out │ ├── spec1.kk │ ├── specialize-map6.kk │ ├── specialize-showlist.kk │ ├── specialize │ │ ├── bintree.kk │ │ ├── bintree.kk.out │ │ ├── branch.kk │ │ ├── branch.kk.out │ │ ├── config.json │ │ ├── fold1.kk │ │ ├── fold1.kk.out │ │ ├── fold2.kk │ │ ├── fold2.kk.out │ │ ├── localdef.kk │ │ ├── localdef.kk.out │ │ ├── map-alias.kk │ │ ├── map-alias.kk.out │ │ ├── map.kk │ │ ├── map.kk.out │ │ ├── map2.kk │ │ ├── map2.kk.out │ │ ├── map3.kk │ │ ├── map3.kk.out │ │ ├── map4.kk │ │ ├── map4.kk.out │ │ ├── map5.kk │ │ ├── map5.kk.out │ │ ├── maptwice.kk │ │ ├── maptwice.kk.out │ │ ├── sieve.kk │ │ ├── sieve.kk.out │ │ ├── tree-list.kk │ │ ├── tree-list.kk.out │ │ ├── twostep-large.kk │ │ ├── twostep-large.kk.out │ │ ├── twostep-large2.kk │ │ ├── twostep-large2.kk.out │ │ ├── while.kk │ │ ├── while.kk.out │ │ ├── zipwithacc.kk │ │ └── zipwithacc.kk.out │ ├── tail.kk │ ├── tail.kk.out │ ├── tail2.kk │ ├── tail2.kk.out │ ├── trace1.kk │ ├── unicode1.kk │ ├── unicode1.kk.out │ ├── unicode2.kk │ ├── unicode2.kk.out │ ├── unicode3.kk │ ├── unicode3.kk.out │ ├── unique1.kk │ ├── unreturn1.kk │ ├── vector1.kk │ ├── vector1.kk.out │ └── wrong │ │ ├── assign1.kk │ │ ├── assign1.kk.out │ │ ├── ctail7.kk │ │ ├── exists1.kk │ │ ├── exists1.kk.out │ │ ├── exists1a.kk │ │ ├── exists1a.kk.out │ │ ├── rec2.kk │ │ ├── recval.kk │ │ └── recval.kk.out ├── finally │ ├── config.json │ ├── file1.kk │ ├── file1a.kk │ ├── finally1.kk │ ├── finally1.kk.out │ ├── finally1a.kk │ ├── finally1a.kk.out │ ├── finally2.kk │ ├── finally2.kk.out │ ├── finally2a.kk │ ├── finally2a.kk.out │ ├── finally2b.kk │ ├── finally2b.kk.out │ ├── finally3.kk │ ├── finally3.kk.out │ ├── finally3a.kk │ ├── finally3a.kk.out │ ├── finally3b.kk │ ├── finally3b.kk.out │ ├── finally4.kk │ ├── finally4.kk.out │ ├── generative1.kk │ ├── initially1.kk │ ├── initially1.kk.out │ ├── initially2.kk │ ├── initially2.kk.out │ ├── initially2a.kk │ ├── initially2a.kk.out │ ├── initially2b.kk │ └── initially2b.kk.out ├── fip │ ├── README.md │ ├── bench.sh │ └── src │ │ ├── ftree │ │ ├── ftree-fip.kk │ │ └── ftree-std.kk │ │ ├── msort │ │ ├── msort-fip.kk │ │ └── msort-std.kk │ │ ├── qsort │ │ ├── qsort-fip.kk │ │ └── qsort-std.kk │ │ ├── rbtree │ │ ├── rbtree-clrs-full.c │ │ ├── rbtree-clrs.c │ │ ├── rbtree-fip-clrs.kk │ │ ├── rbtree-fip-icfp.kk │ │ ├── rbtree-fip.kk │ │ ├── rbtree-std.kk │ │ └── rbtree-stl.cpp │ │ └── tmap │ │ ├── tmap-fip.c │ │ ├── tmap-fip.kk │ │ ├── tmap-std.c │ │ └── tmap-std.kk ├── jsgen │ ├── config.json │ ├── err.kk │ ├── err.kk.out │ ├── exn.kk │ ├── exn.kk.out │ ├── parse-int.kk │ ├── parse-int.kk.out │ ├── vector-assign.kk │ └── vector-assign.kk.out ├── kind │ ├── alias1.kk │ ├── alias1.kk.out │ ├── alias2.kk │ ├── alias2.kk.out │ ├── alias3.kk │ ├── alias3.kk.out │ ├── alias4.kk │ ├── alias4.kk.out │ ├── bgroup1.kk │ ├── bgroup1.kk.out │ ├── bgroup2.kk │ ├── bgroup2.kk.out │ ├── bgroup3.kk │ ├── bgroup3.kk.out │ ├── config.json │ ├── fix1.kk │ ├── fix1.kk.out │ ├── fix1a.kk │ ├── fix1a.kk.out │ ├── fix2.kk │ ├── fix2.kk.out │ ├── type1.kk │ ├── type1.kk.out │ ├── type10.kk │ ├── type10.kk.out │ ├── type2.kk │ ├── type2.kk.out │ ├── type3.kk │ ├── type3.kk.out │ ├── type4.kk │ ├── type4.kk.out │ ├── type5.kk │ ├── type5.kk.out │ ├── type6.kk │ ├── type6.kk.out │ ├── type7.kk │ ├── type7.kk.out │ ├── type8.kk │ ├── type8.kk.out │ ├── type9.kk │ ├── type9.kk.out │ └── wrong │ │ ├── alias1.kk │ │ ├── alias1.kk.out │ │ ├── negative2.kk │ │ ├── negative2.kk.out │ │ ├── rec1.kk │ │ ├── rec1.kk.out │ │ ├── rec2.kk │ │ ├── rec2.kk.out │ │ ├── type1.kk │ │ ├── type1.kk.out │ │ ├── type2.kk │ │ ├── type2.kk.out │ │ ├── type3.kk │ │ ├── type3.kk.out │ │ ├── type4.kk │ │ ├── type4.kk.out │ │ ├── type7.kk │ │ └── type7.kk.out ├── lazy │ ├── indirect-compress.kk │ ├── queue │ │ ├── bankers.kk │ │ ├── batched.kk │ │ ├── bench.kk │ │ ├── physicists-stack.kk │ │ ├── realtime-fip.kk │ │ ├── realtime-fip2.kk │ │ └── realtime.kk │ ├── sieve.kk │ └── wrong │ │ ├── lazy1.kk │ │ └── lazy2.kk ├── lib │ ├── bigint1.kk │ ├── bigint1.kk.out │ ├── bigint2.kk │ ├── bigint2.kk.out │ ├── bigint3.kk │ ├── bigint3.kk.out │ ├── calendar.hs │ ├── calendar.kk │ ├── config.json │ ├── ddouble1.kk │ ├── ddouble1.kk.out │ ├── ddouble2.kk │ ├── ddouble2.kk.out │ ├── ddouble3.kk │ ├── ddouble3.kk.out │ ├── decimal1.kk │ ├── decimal1.kk.out │ ├── dir.kk │ ├── dir.kk.out │ ├── dir │ │ ├── file-a.txt │ │ └── file-b │ ├── double1.kk │ ├── double1.kk.out │ ├── double2.kk │ ├── double2.kk.out │ ├── double3.kk │ ├── double3.kk.out │ ├── double4.kk │ ├── double4.kk.out │ ├── file1.kk │ ├── file1.kk.out │ ├── http-server1.kk │ ├── isomonth.hs │ ├── isomonth.kk │ ├── jaro.kk │ ├── jaro.kk.out │ ├── jaro2.kk │ ├── jaro2.kk.out │ ├── range1.kk │ ├── range1.kk.out │ ├── ref-modify.kk │ ├── ref-modify.kk.out │ ├── ref-vector-set.kk │ ├── ref-vector-set.kk.out │ ├── slice.kk │ ├── slice.kk.out │ ├── string.kk │ ├── string.kk.out │ ├── time-parse.kk │ ├── time-parse.kk.out │ ├── time-utc1.kk │ ├── time1.kk │ ├── time1.kk.out │ ├── time10.kk │ ├── time10.kk.out │ ├── time11.kk │ ├── time11.kk.out │ ├── time2.kk │ ├── time2.kk.out │ ├── time2main.kk │ ├── time3.kk │ ├── time3.kk.out │ ├── time4.kk │ ├── time4.kk.out │ ├── time5.kk │ ├── time5.kk.out │ ├── time6.kk │ ├── time6.kk.out │ ├── time7.kk │ ├── time7.kk.out │ ├── time8.kk │ ├── time8.kk.out │ ├── time9.kk │ ├── time9.kk.out │ ├── vector1.kk │ └── vector1.kk.out ├── mask │ ├── config.json │ ├── inject-behind1.kk │ ├── inject-behind1.kk.out │ ├── inject1.kk │ ├── inject1.kk.out │ ├── inject2.kk │ ├── inject2.kk.out │ ├── inject3.kk │ ├── inject3.kk.out │ ├── inject4.kk │ ├── inject4.kk.out │ ├── inject4.out │ ├── inject4a.kk │ ├── inject4a.kk.out │ ├── inject4a.out │ ├── inject4b.kk │ └── inject4b.out ├── medium │ ├── allsamples.kk │ ├── allsamples.kk.out │ ├── caesar.kk │ ├── caesar.kk.out │ ├── collatz.kk │ ├── collatz.kk.out │ ├── config.json │ ├── fibonacci.kk │ ├── fibonacci.kk.out │ ├── garcia-wachs-nosemi.kk │ ├── garcia-wachs.kk │ ├── garcia-wachs.kk.out │ ├── gcd.kk │ ├── gcd.kk.out │ ├── nqueens.kk.out │ └── splaytree.kk ├── misc │ ├── ambients │ │ ├── acommon.kk │ │ ├── aheap1.kk │ │ ├── aheap2.kk │ │ ├── aheap3.kk │ │ ├── aheap4.kk │ │ ├── ambient1.kk │ │ ├── ambient2.kk │ │ ├── ambient3.kk │ │ ├── anim.kk │ │ ├── aparser.kk │ │ ├── ashallow.kk │ │ ├── astate.kk │ │ ├── context3.kk │ │ └── tunnel.kk │ ├── evidence │ │ ├── ev-examples1.kk │ │ ├── ev1.kk │ │ ├── ev2.kk │ │ ├── ev3.kk │ │ ├── ev4.kk │ │ ├── ev5.kk │ │ ├── evscoped1.kk │ │ ├── evscoped2.kk │ │ ├── evscoped3.kk │ │ ├── scopedresume1.kk │ │ ├── yld.js │ │ ├── yld4.js │ │ └── yld5.js │ └── instance │ │ ├── corrl1.kk │ │ ├── corrl2.kk │ │ ├── effdup1.kk │ │ ├── file1.kk │ │ ├── heap1.kk │ │ ├── instance1.kk │ │ ├── instance2.kk │ │ ├── instance3.kk │ │ ├── instance4.kk │ │ ├── instance4a.kk │ │ ├── namedh-named.kk │ │ ├── namedh-namedscoped.kk │ │ ├── namedh-scoped.kk │ │ ├── namedh-umbrella.kk │ │ ├── rec-type1.kk │ │ ├── rec-type2.kk │ │ ├── state1.kk │ │ ├── state3.kk │ │ ├── state4.kk │ │ └── wrong │ │ ├── inject1.kk │ │ ├── inject1.out │ │ ├── resource1.kk │ │ ├── resource1a.flags │ │ ├── resource1a.kk │ │ ├── resource1a.out │ │ ├── resource2b.kk │ │ ├── resource4.kk │ │ └── resource4a.kk ├── overload │ ├── blowup1.kk │ ├── blowup2.kk │ ├── config.json │ ├── eq1.kk │ ├── eqcmp1.kk │ ├── eta1.kk │ ├── eta1.kk.out │ ├── eta2.kk │ ├── eta2.kk.out │ ├── extensible-types.kk │ ├── hello.kk │ ├── implicit1.kk │ ├── monad1.kk │ ├── monad2.kk │ ├── monad3.kk │ ├── monad3a.kk │ ├── monoid1.kk │ ├── monoid2.kk │ ├── num1.kk │ ├── num1.kk.out │ ├── over1.kk │ ├── over2.kk │ ├── set1.kk │ ├── show1.kk │ ├── show2.kk │ ├── show3.kk │ ├── show4.kk │ ├── testA.kk │ └── testB.kk ├── parc │ ├── beans.kk │ ├── config.json │ ├── hcounter.kk │ ├── hqueens.kk │ ├── inline1.kk │ ├── inline2.kk │ ├── inline3.kk │ ├── inline4.kk │ ├── inline5.kk │ ├── parc-leak1.kk │ ├── parc-leak1b.kk │ ├── parc1.kk │ ├── parc1.kk.out │ ├── parc10.kk │ ├── parc10.kk.out │ ├── parc11.kk │ ├── parc11.kk.out │ ├── parc12.kk │ ├── parc12.kk.out │ ├── parc13.kk │ ├── parc13.kk.out │ ├── parc14.kk │ ├── parc14.kk.out │ ├── parc15.kk │ ├── parc15.kk.out │ ├── parc16.kk │ ├── parc16.kk.out │ ├── parc17.kk │ ├── parc17.kk.out │ ├── parc18.kk │ ├── parc18.kk.out │ ├── parc19.kk │ ├── parc19.kk.out │ ├── parc2.kk │ ├── parc2.kk.out │ ├── parc20.kk │ ├── parc20.kk.out │ ├── parc21.kk │ ├── parc21.kk.out │ ├── parc22.kk │ ├── parc22.kk.out │ ├── parc23.kk │ ├── parc23.kk.out │ ├── parc3.kk │ ├── parc3.kk.out │ ├── parc4.kk │ ├── parc4.kk.out │ ├── parc5.kk │ ├── parc5.kk.out │ ├── parc6.kk │ ├── parc6.kk.out │ ├── parc7.kk │ ├── parc7.kk.out │ ├── parc8.kk │ ├── parc8.kk.out │ ├── parc9.kk │ ├── parc9.kk.out │ ├── reuse-spec1.kk │ ├── reuse1.kk │ ├── reuse2.kk │ ├── reuse3.kk │ └── reuse4.kk ├── perf │ ├── benchmark.kk │ ├── csv.kk │ ├── heaps │ │ ├── base.kk │ │ ├── binomial-heaps-okasaki.kk │ │ ├── haskell-sort.kk │ │ ├── leftist-heaps-okasaki.kk │ │ ├── pairing-heaps-okasaki.kk │ │ ├── pairing-heaps-tailcall.kk │ │ ├── splay-heaps-fbip.kk │ │ ├── splay-heaps-okasaki.kk │ │ ├── testsuite.kk │ │ └── weight-biased-leftist-heaps-okasaki.kk │ ├── run-benchmarks.kk │ └── sets │ │ ├── HaskellBench.hs │ │ ├── ZipSet.hs │ │ ├── b-trees-pad-full.kk │ │ ├── b-trees-pad-separate-fast-path.kk │ │ ├── b-trees-pad-separate.kk │ │ ├── b-trees.kk │ │ ├── base.kk │ │ ├── patricia-tree-big-endian-okasaki.kk │ │ ├── patricia-tree-data-intset-clz.kk │ │ ├── patricia-tree-data-intset.kk │ │ ├── patricia-tree-little-endian-okasaki.kk │ │ ├── rbtree-fbip.kk │ │ ├── rbtree-okasaki.kk │ │ ├── skip-list-imperative.kk │ │ ├── skip-list-vector.kk │ │ ├── splay-trees-fbip.kk │ │ ├── testsuite.kk │ │ ├── weight-balanced-data-set.kk │ │ ├── weight-balanced-fbip-int.kk │ │ ├── weight-balanced-fbip.kk │ │ ├── weight-balanced-hirai.kk │ │ └── zip-trees-fbip.kk ├── readme.md ├── static │ ├── config.json │ ├── div1.kk │ ├── div1.kk.out │ ├── div2-ack.kk │ ├── div2-ack.kk.out │ ├── div3.kk │ ├── div3.kk.out │ ├── modA.kk │ ├── modA.kk.out │ ├── modAWrong.kk │ ├── modAWrong.kk.out │ ├── modB.kk │ ├── modB.kk.out │ ├── module1.kk │ ├── module1.kk.out │ ├── module1a.kk │ ├── module1a.kk.out │ ├── recursive1.kk │ ├── recursive1.kk.out │ ├── shadow3a.kk │ ├── shadow3a.kk.out │ ├── shadow3b.kk │ ├── shadow3b.kk.out │ ├── wrong │ │ ├── alias1.kk │ │ ├── alias1.kk.out │ │ ├── case1.kk │ │ ├── case1.kk.out │ │ ├── case2.kk │ │ ├── case2.kk.out │ │ ├── case4.kk │ │ ├── case4.kk.out │ │ ├── case5.kk │ │ ├── case5.kk.out │ │ ├── case5a.kk │ │ ├── case5a.kk.out │ │ ├── case6.kk │ │ ├── case6.kk.out │ │ ├── config.json │ │ ├── duplicate1.kk │ │ ├── duplicate1.kk.out │ │ ├── duplicate2.kk │ │ ├── duplicate2.kk.out │ │ ├── duplicate3.kk │ │ ├── duplicate3.kk.out │ │ ├── duplicate3a.kk │ │ ├── duplicate3a.kk.out │ │ ├── duplicate3b.kk │ │ ├── duplicate3b.kk.out │ │ ├── module1.kk │ │ ├── module1.kk.out │ │ ├── module2.kk │ │ ├── module2.kk.out │ │ ├── rec1.kk │ │ ├── rec1.kk.out │ │ ├── shadow1.kk │ │ ├── shadow1.kk.out │ │ ├── shadow2.kk │ │ ├── shadow2.kk.out │ │ ├── shadow3.kk │ │ ├── shadow3.kk.out │ │ ├── shadow4.kk │ │ └── shadow4.kk.out │ ├── xcase1.kk │ └── xcase1.kk.out ├── syntax │ ├── braces1.kk │ ├── comment1.kk │ ├── comment1.kk.out │ ├── config.json │ ├── final-ctl.kk │ ├── final-ctl.kk.out │ ├── layout1.kk │ ├── layout1.kk.out │ ├── layout2.kk │ ├── layout2.kk.out │ ├── syntax1.kk │ ├── syntax1.kk.out │ ├── trailing1.kk │ ├── trailing1.kk.out │ ├── trailing2.kk │ ├── trailing2.kk.out │ ├── type1.kk │ ├── type1.kk.out │ ├── use1.kk │ ├── use1.kk.out │ ├── use2.kk │ ├── use2.kk.out │ ├── utf1.kk │ ├── utf1.kk.out │ ├── utf2.kk │ ├── utf2.kk.out │ └── wrong │ │ ├── braces1.kk │ │ ├── braces1.kk.out │ │ ├── braces2.kk │ │ ├── braces2.kk.out │ │ ├── unused1.kk │ │ ├── unused1.kk.out │ │ ├── unused2.kk │ │ ├── unused2.kk.out │ │ ├── unused3.kk │ │ ├── unused3.kk.out │ │ ├── utf1.kk │ │ └── utf1.kk.out └── type │ ├── alias.kk │ ├── alias.kk.out │ ├── args1.kk │ ├── args1.kk.out │ ├── config.json │ ├── data1.kk │ ├── data2.kk │ ├── eff-rec1.kk │ ├── eff-rec1.kk.out │ ├── eff-rec1a.kk │ ├── eff-rec1a.kk.out │ ├── eff1.kk │ ├── eff1.kk.out │ ├── eff2.kk │ ├── eff2.kk.out │ ├── eff3.kk │ ├── eff3.kk.out │ ├── eff4.kk │ ├── eff4.kk.out │ ├── eff4a.kk │ ├── eff4a.kk.out │ ├── eff4b.kk │ ├── eff4b.kk.out │ ├── eff4c.kk │ ├── eff4c.kk.out │ ├── eff5.kk │ ├── eff5.kk.out │ ├── eff5a.kk │ ├── eff5a.kk.out │ ├── eff6.kk │ ├── eff6.kk.out │ ├── eff6a.kk │ ├── eff6a.kk.out │ ├── eff6b.kk │ ├── eff6b.kk.out │ ├── eff7.kk │ ├── eff7.kk.out │ ├── eff7a.kk │ ├── eff7a.kk.out │ ├── eff8.kk │ ├── eff8.kk.out │ ├── eff8a.kk │ ├── eff8a.kk.out │ ├── eff8b.kk │ ├── eff8b.kk.out │ ├── eff9.kk │ ├── eff9.kk.out │ ├── exp1.kk │ ├── higherrank2.kk │ ├── higherrank2.kk.out │ ├── higherrank3.kk │ ├── higherrank3.kk.out │ ├── hm1.kk │ ├── hm1.kk.out │ ├── hm2.kk │ ├── hm2.kk.out │ ├── hm3.kk │ ├── hm3.kk.out │ ├── hr1.kk │ ├── hr1.kk.out │ ├── hr1a.kk │ ├── hr1a.kk.out │ ├── hr2.kk │ ├── hr2.kk.out │ ├── hr3.kk │ ├── hr3.kk.out │ ├── hr3a.kk │ ├── hr3a.kk.out │ ├── hr3b.kk │ ├── hr3b.kk.out │ ├── hr3c.kk │ ├── hr3c.kk.out │ ├── hr6.kk │ ├── hr6.kk.out │ ├── hr7.kk │ ├── hr7.kk.out │ ├── import-alias.kk │ ├── import-alias.kk.out │ ├── inf1.kk │ ├── inf1.kk.out │ ├── masklocal1.kk │ ├── masklocal1.kk.out │ ├── masklocal2.kk │ ├── masklocal2.kk.out │ ├── masklocal3.kk │ ├── masklocal3.kk.out │ ├── match1.kk │ ├── match1.kk.out │ ├── matchcon1.kk │ ├── matchcon1.kk.out │ ├── opt1.kk │ ├── opt1.kk.out │ ├── opt2.kk │ ├── opt2.kk.out │ ├── pat1.kk │ ├── talpin-jouvelot1.kk │ ├── talpin-jouvelot1.kk.out │ ├── warn1.kk │ ├── warn1.kk.out │ └── wrong │ ├── div1.kk │ ├── div1.kk.out │ ├── div2.kk │ ├── div2.kk.out │ ├── div3.kk │ ├── div3.kk.out │ ├── effect1.kk │ ├── effect2.kk │ ├── higherrank1.kk │ ├── higherrank1.kk.out │ ├── higherrank2.kk │ ├── higherrank2.kk.out │ ├── higherrank3.kk │ ├── higherrank3.kk.out │ ├── higherrank3a.kk │ ├── higherrank3a.kk.out │ ├── higherrank3v.kk │ ├── higherrank3v.kk.out │ ├── hm1.kk │ ├── hm1.kk.out │ ├── hm2.kk │ ├── hm2.kk.out │ ├── hm3.kk │ ├── hm3.kk.out │ ├── hm4.kk │ ├── hm4.kk.out │ ├── hm4a.kk │ ├── hm4a.kk.out │ ├── hr1.kk │ ├── hr1.kk.out │ ├── hr2.kk │ ├── hr2.kk.out │ ├── hr3.kk │ ├── hr3.kk.out │ ├── hr4.kk │ ├── hr4.kk.out │ ├── hr5.kk │ ├── hr5.kk.out │ ├── hr6.kk │ ├── hr6.kk.out │ ├── hr7.kk │ ├── hr7.kk.out │ ├── hr7a.kk │ ├── hr7a.kk.out │ ├── local-shadow.kk │ ├── local-shadow.kk.out │ ├── open1.kk │ ├── open1.kk.out │ ├── open2.kk │ ├── open2.kk.out │ ├── open3.kk │ ├── open3.kk.out │ ├── overlap1.kk │ ├── overlap1.kk.out │ ├── overlap2.kk │ ├── overlap2.kk.out │ ├── overlap3.kk │ ├── overlap3.kk.out │ ├── pat1.kk │ ├── scheduler1.kk │ ├── scheduler1.kk.out │ ├── scheduler2.kk │ ├── scheduler2.kk.out │ ├── scheduler3.kk │ ├── scheduler3.kk.out │ ├── scheduler4.kk │ ├── scheduler4.kk.out │ ├── scheduler5.kk │ ├── scheduler5.kk.out │ ├── st1.kk │ ├── st1.kk.out │ ├── val1.kk │ ├── val1.kk.out │ ├── val1a.kk │ ├── val1a.kk.out │ └── var1.kk ├── util ├── Dockerfile ├── Dockerfile-minimal ├── README.md ├── bundle.kk ├── docs.kk ├── grammar.kk ├── install.bat ├── install.sh ├── link-min.kk ├── link-std.kk ├── link-test.kk ├── minbuild.sh ├── packaging │ ├── build.sh │ ├── distros │ │ ├── alpine.Dockerfile │ │ ├── alpine │ │ │ └── install-ghc.sh │ │ ├── arch.Dockerfile │ │ ├── arch │ │ │ └── install-ghc.sh │ │ ├── builder.sh │ │ ├── opensuse.Dockerfile │ │ ├── rhel.Dockerfile │ │ ├── rhel │ │ │ └── install-ghc.sh │ │ └── ubuntu.Dockerfile │ ├── fpm.Dockerfile │ ├── package.sh │ ├── readme.md │ ├── scripts │ │ ├── post-install.sh │ │ ├── pre-remove.sh │ │ └── script-behavious.md │ └── util.sh ├── release.md ├── reversion.kk └── windows-install.sed └── whatsnew.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat eol=crlf -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "kklib/mimalloc"] 2 | path = kklib/mimalloc 3 | url = https://github.com/microsoft/mimalloc 4 | -------------------------------------------------------------------------------- /.valgrindrc: -------------------------------------------------------------------------------- 1 | --leak-check=full 2 | --show-leak-kinds=all 3 | --show-reachable=yes 4 | -------------------------------------------------------------------------------- /doc/bench-amd3600-nov-2020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/bench-amd3600-nov-2020.png -------------------------------------------------------------------------------- /doc/logo/koka-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-banner.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-100.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-200.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-400.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-filled.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-url.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-v2-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-v2-100.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-v2-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-v2-200.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-v2-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-v2-400.png -------------------------------------------------------------------------------- /doc/logo/koka-logo-v2-800.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo-v2-800.png -------------------------------------------------------------------------------- /doc/logo/koka-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/koka-logo.png -------------------------------------------------------------------------------- /doc/logo/logo.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/logo/logo.docx -------------------------------------------------------------------------------- /doc/snippet-rbtree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/snippet-rbtree.png -------------------------------------------------------------------------------- /doc/snippet-yield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/snippet-yield.png -------------------------------------------------------------------------------- /doc/spec/images/penrose-tiling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/penrose-tiling.png -------------------------------------------------------------------------------- /doc/spec/images/perceus-perf-bw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/perceus-perf-bw.png -------------------------------------------------------------------------------- /doc/spec/images/perceus-perf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/perceus-perf.png -------------------------------------------------------------------------------- /doc/spec/images/perceus3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/perceus3.jpg -------------------------------------------------------------------------------- /doc/spec/images/vscode-caesar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-caesar.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-codelens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-codelens.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-commands.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-inlay-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-inlay-off.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-inlay-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-inlay-on.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-install-compiler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-install-compiler.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-install.png -------------------------------------------------------------------------------- /doc/spec/images/vscode-rbtree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/images/vscode-rbtree.png -------------------------------------------------------------------------------- /doc/spec/styles/koka-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/spec/styles/koka-logo.png -------------------------------------------------------------------------------- /doc/spec/unchecked.json: -------------------------------------------------------------------------------- 1 | { "name": "unchecked", 2 | "extend": "koka", 3 | "extraKeywords": [] 4 | } -------------------------------------------------------------------------------- /doc/system-logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/doc/system-logos.png -------------------------------------------------------------------------------- /kklib/ide/vs2019/kklib-test.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /kklib/ide/vs2019/kklib.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ..\..\..\out\lib\interactive-dbg.exe 5 | WindowsLocalDebugger 6 | 7 | 8 | -------------------------------------------------------------------------------- /kklib/test/time.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef int64_t msecs_t; 6 | 7 | msecs_t _clock_start(void); 8 | msecs_t _clock_end(msecs_t start); 9 | -------------------------------------------------------------------------------- /lib/std/time/timescales.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/lib/std/time/timescales.png -------------------------------------------------------------------------------- /lib/v1/demo/fib.kk: -------------------------------------------------------------------------------- 1 | // Example of an imperative version of the fibonacci function; 2 | function main() 3 | { 4 | val n = 10 5 | println("fibonacci(" + n.show + ") is " + fib(n).show ); 6 | } 7 | 8 | // Calculate the n'th fibonacci number 9 | function fib(n) 10 | { 11 | var x := 0 12 | var y := 1 13 | repeat(n) { 14 | val y0 = y 15 | y := x+y 16 | x := y0 17 | } 18 | return x 19 | } -------------------------------------------------------------------------------- /lib/v1/std/sys/dom/domException.kk: -------------------------------------------------------------------------------- 1 | public module dom.domException 2 | 3 | // Exception type generated by esidl 0.2.0. 4 | 5 | -------------------------------------------------------------------------------- /lib/v1/std/sys/dom/events/eventException.kk: -------------------------------------------------------------------------------- 1 | public module dom.events.eventException 2 | 3 | // Exception type generated by esidl 0.2.0. 4 | 5 | -------------------------------------------------------------------------------- /lib/v1/std/sys/dom/file/fileException.kk: -------------------------------------------------------------------------------- 1 | public module dom.file.fileException 2 | 3 | // Exception type generated by esidl 0.2.0. 4 | 5 | -------------------------------------------------------------------------------- /lib/v1/std/sys/dom/ranges/rangeException.kk: -------------------------------------------------------------------------------- 1 | public module dom.ranges.rangeException 2 | 3 | // Exception type generated by esidl 0.2.0. 4 | 5 | -------------------------------------------------------------------------------- /src/Main/README.md: -------------------------------------------------------------------------------- 1 | There are the main front-ends for the Koka compiler: 2 | 3 | - `langserver`: the regular Koka compiler with VS code language server support. 4 | See also `support/vscode` for the VS code extension. 5 | 6 | - `plain`: Koka compiler + interpreter without language server support; this is mainly 7 | to support platforms where the Haskell language server library does not build. 8 | 9 | 10 | -------------------------------------------------------------------------------- /support/atom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "homepage": "https://github.com/koka-lang/koka", 3 | "name": "language-koka", 4 | "description": "Koka language highlighting", 5 | "version": "2.0.0" 6 | } 7 | -------------------------------------------------------------------------------- /support/atom/settings/language-koka.cson: -------------------------------------------------------------------------------- 1 | '.source.koka': 2 | 'editor': 3 | 'autoIndentOnPaste': false 4 | 'softTabs': true 5 | 'tabLength': 2 6 | 'commentStart': '// ' 7 | -------------------------------------------------------------------------------- /support/sublime-text/Jake-Haskell.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": ["jake","compiler"], 3 | "file_regex": "^([\\w\\-\\.\\\\/]+):([0-9]+):([0-9]+):\\s*[\\r\\n]*\\s*(.*)$", 4 | "working_dir": "${project_path:${folder:${file_path}}}", 5 | "selector": "source.makefile", 6 | 7 | "windows": { 8 | "cmd": ["jake.cmd","compiler"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /support/sublime-text/Koka/koka.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | // "color_scheme": "Packages/Color Scheme - Default/Snow.tmTheme", 3 | "tab_size": 2, 4 | "translate_tabs_to_spaces": true, 5 | "use_tab_stops": true, 6 | "detect_indentation": false, 7 | "auto_indent": true, 8 | "smart_indent": true, 9 | "indent_to_bracket": true, 10 | "tab_completion": true 11 | } -------------------------------------------------------------------------------- /support/sublime-text/Koka/kokadoc.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | // "color_scheme": "Packages/Color Scheme - Default/Snow.tmTheme", 3 | "tab_size": 2, 4 | "translate_tabs_to_spaces": true, 5 | "use_tab_stops": true, 6 | "detect_indentation": false, 7 | "auto_indent": true, 8 | "smart_indent": true, 9 | "indent_to_bracket": true, 10 | "tab_completion": true 11 | } -------------------------------------------------------------------------------- /support/vim/ftdetect/koka.vim: -------------------------------------------------------------------------------- 1 | au BufNewfile,BufEnter *.kk setf koka 2 | -------------------------------------------------------------------------------- /support/vscode/koka.language-koka/images/codelens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/support/vscode/koka.language-koka/images/codelens.png -------------------------------------------------------------------------------- /support/vscode/koka.language-koka/images/impliciteq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/support/vscode/koka.language-koka/images/impliciteq.png -------------------------------------------------------------------------------- /support/vscode/koka.language-koka/images/inlayhints-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/support/vscode/koka.language-koka/images/inlayhints-off.png -------------------------------------------------------------------------------- /support/vscode/koka.language-koka/images/inlayhints.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/support/vscode/koka.language-koka/images/inlayhints.png -------------------------------------------------------------------------------- /support/vscode/koka.language-koka/images/koka-logo-filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/support/vscode/koka.language-koka/images/koka-logo-filled.png -------------------------------------------------------------------------------- /support/vscode/koka.language-koka/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2020", 5 | "lib": [ 6 | "es2020" 7 | ], 8 | "outDir": "out", 9 | "sourceMap": true, 10 | "strict": false, 11 | "rootDir": "src" 12 | }, 13 | "exclude": [ 14 | "node_modules", 15 | ".vscode-test" 16 | ] 17 | } -------------------------------------------------------------------------------- /test/algeff/config.json: -------------------------------------------------------------------------------- 1 | "--showtypesigs -e" 2 | -------------------------------------------------------------------------------- /test/algeff/cps-cgen1.kk: -------------------------------------------------------------------------------- 1 | 2 | fun map-acc( xs : list, f : a -> e b, acc : list = [] ) : e list { 3 | match(xs) { 4 | Nil -> acc.reverse 5 | Cons(x,xx) -> xx.map-acc(f, Cons(f(x),acc)) 6 | } 7 | } 8 | 9 | fun main() { 10 | [1,2].map-acc(show).join(",").println 11 | } -------------------------------------------------------------------------------- /test/algeff/cps-cgen1a.kk: -------------------------------------------------------------------------------- 1 | 2 | fun map-acc( xs : list, f : a -> e b, acc : list ) : e list { 3 | match(xs) { 4 | Nil -> acc.reverse 5 | Cons(x,xx) -> xx.map-acc(f, Cons(f(x),acc)) 6 | } 7 | } 8 | 9 | fun main() { 10 | [1,2].map-acc(show,[]).join(",").println 11 | } -------------------------------------------------------------------------------- /test/algeff/cps1.kk.out: -------------------------------------------------------------------------------- 1 | [1,3] 2 | 3 | algeff/cps1/main: () -> console () 4 | algeff/cps1/mapIndexedPeekX: forall (xs : list, f : (idx : int, value : a, rest : list) -> e b) -> e list -------------------------------------------------------------------------------- /test/algeff/cps2.kk: -------------------------------------------------------------------------------- 1 | // triggers strange lifting during cps of letrec 2 | // because the else branch needs cps translation (but not the rest) 3 | 4 | val test = if (True || True) then (fn(x){x}) else (fn(x) { !(ref(x)) }) 5 | 6 | fun main() { 7 | test(42).show.println 8 | } -------------------------------------------------------------------------------- /test/algeff/cps2.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/cps2/main: () -> console () 4 | algeff/cps2/test: forall (x : a) -> a -------------------------------------------------------------------------------- /test/algeff/cps3.kk: -------------------------------------------------------------------------------- 1 | // test duplicate cps translation of polymorphic results 2 | 3 | fun compose1(f,g) { 4 | fun comp(x) { 5 | f(g(x)) 6 | } 7 | comp 8 | } 9 | 10 | 11 | fun compose2(f,g) { 12 | return fn(x) { 13 | f(g(x)) 14 | } 15 | } 16 | 17 | fun main() { 18 | println(compose1(inc,inc)(42)) 19 | println(compose2(inc,inc)(42)) 20 | } 21 | -------------------------------------------------------------------------------- /test/algeff/cps3.kk.out: -------------------------------------------------------------------------------- 1 | 44 2 | 44 3 | 4 | algeff/cps3/compose1: forall (f : (a) -> e b, g : (c) -> e a) -> ((x : c) -> e b) 5 | algeff/cps3/compose2: forall (f : (a) -> e b, g : (c) -> e a) -> ((x : c) -> e b) 6 | algeff/cps3/main: () -> console () -------------------------------------------------------------------------------- /test/algeff/cps5.kk: -------------------------------------------------------------------------------- 1 | 2 | fun foo( x : int, y : int ) { 3 | val x1 = if (x >= 0) then apply(id,1) else 2 4 | val y1 = if (y >= 0) then 1 else 2 5 | x1+y1 6 | } 7 | 8 | fun main() { 9 | foo(1,2).println 10 | } -------------------------------------------------------------------------------- /test/algeff/cps5.kk.out: -------------------------------------------------------------------------------- 1 | 2 2 | 3 | algeff/cps5/foo: (x : int, y : int) -> int 4 | algeff/cps5/main: () -> console () -------------------------------------------------------------------------------- /test/algeff/eff-constant.kk: -------------------------------------------------------------------------------- 1 | // issue: https://github.com/koka-lang/koka/issues/353 2 | fun x() : () 3 | () -------------------------------------------------------------------------------- /test/algeff/eff-constant.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/eff-constant@kk(2,12): parse error: invalid syntax 2 | encountered effect variable e when an effect label was expected 3 | hint: effect variables must be after `|` (e@g ``), or by themselves (e@g@ `e`) -------------------------------------------------------------------------------- /test/algeff/eff-constant2.kk: -------------------------------------------------------------------------------- 1 | // issue: https://github.com/koka-lang/koka/issues/60 2 | effect gen { 3 | ctl yield(item: a): () 4 | } 5 | 6 | fun list(program : () -> , e> ()): e list { 7 | handle(program) { 8 | yield(x) -> Cons(x, resume(())) 9 | return _ -> Nil 10 | } 11 | } -------------------------------------------------------------------------------- /test/algeff/eff-constant2.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/eff-constant2@kk(6,40): parse error: invalid syntax 2 | encountered effect variable e when an effect label was expected 3 | hint: effect variables must be after `|` (e@g ``), or by themselves (e@g@ `e`) -------------------------------------------------------------------------------- /test/algeff/eff-poly1.kk: -------------------------------------------------------------------------------- 1 | 2 | effect cheating { 3 | fun cheat(player:int) : a 4 | } 5 | -------------------------------------------------------------------------------- /test/algeff/eff-poly2.kk: -------------------------------------------------------------------------------- 1 | 2 | effect amb { 3 | fun flip() : bool 4 | fun fail() : a 5 | } 6 | -------------------------------------------------------------------------------- /test/algeff/eff-rec2.kk: -------------------------------------------------------------------------------- 1 | // https://github.com/koka-lang/koka/issues/385 2 | pub div effect parse 3 | fun current-input() : sslice 4 | 5 | pub fun parse-safe( input0 : sslice, p) 6 | var input := input0 7 | with handler 8 | fun current-input() 9 | input 10 | p() 11 | 12 | pub fun main() 13 | with parse-safe("hello".slice) 14 | val x = current-input() 15 | x.show.println -------------------------------------------------------------------------------- /test/algeff/eff-rec2.kk.out: -------------------------------------------------------------------------------- 1 | "hello" 2 | 3 | algeff/eff-rec2/current-input: () -> sslice 4 | algeff/eff-rec2/main: () -> () 5 | algeff/eff-rec2/parse-safe: forall (input0 : sslice, p : () -> a) -> e a -------------------------------------------------------------------------------- /test/algeff/effs-exists1.kk: -------------------------------------------------------------------------------- 1 | // test operators with existential bindings 2 | 3 | effect many { 4 | fun flip() : bool 5 | fun fail() : a 6 | } 7 | 8 | val many = handler { 9 | return x -> [x] 10 | flip() -> resume(True) + resume(False) 11 | fail() -> [] 12 | } 13 | 14 | fun test() { 15 | if (flip()) then 1 else fail() 16 | } 17 | 18 | fun main() { 19 | many(test).map(show).join(",").println 20 | } -------------------------------------------------------------------------------- /test/algeff/effs-exists2.kk: -------------------------------------------------------------------------------- 1 | // test operators with existential bindings 2 | 3 | effect ex { 4 | fun identity(x : a) : a 5 | } 6 | 7 | val ex = handler { 8 | identity( x ) -> resume(x) 9 | } 10 | 11 | fun test() { 12 | identity(42) 13 | } 14 | 15 | fun main() { 16 | ex(test).println 17 | } -------------------------------------------------------------------------------- /test/algeff/effs-exists3.kk: -------------------------------------------------------------------------------- 1 | // test operators with existential bindings 2 | 3 | effect ex { 4 | fun identity(x : a, i : s) : a 5 | } 6 | 7 | val ex = handler(s) { 8 | identity( x ) -> resume(x,s) 9 | } 10 | 11 | fun test() { 12 | identity(42,'a') 13 | } 14 | 15 | fun main() { 16 | ex(test).println 17 | } -------------------------------------------------------------------------------- /test/algeff/effs1.kk: -------------------------------------------------------------------------------- 1 | module effs1 2 | 3 | effect amb { 4 | ctl flip() : bool 5 | } 6 | 7 | fun xor() : amb bool { 8 | val p = flip() 9 | val q = flip() 10 | (p||q) && not(p&&q) 11 | } 12 | 13 | val amb = handler { 14 | return(x){ [x] } 15 | ctl flip(){ resume(False) ++ resume(True) } 16 | } 17 | 18 | fun main() { 19 | amb(xor).show.println 20 | } 21 | -------------------------------------------------------------------------------- /test/algeff/effs1.kk.out: -------------------------------------------------------------------------------- 1 | [False,True,True,False] 2 | 3 | algeff/effs1/amb: forall (() -> a) -> e list 4 | algeff/effs1/flip: () -> amb bool 5 | algeff/effs1/main: () -> console () 6 | algeff/effs1/xor: () -> amb bool -------------------------------------------------------------------------------- /test/algeff/effs1b.kk.out: -------------------------------------------------------------------------------- 1 | [False,True,True,False] 2 | 3 | algeff/effs1b/amb: forall (action : () -> a) -> e list 4 | algeff/effs1b/flip: () -> amb bool 5 | algeff/effs1b/main: () -> console () 6 | algeff/effs1b/xor: () -> amb bool -------------------------------------------------------------------------------- /test/algeff/effs3.kk.out: -------------------------------------------------------------------------------- 1 | negative or zero 2 | 3 | algeff/effs3/get: forall () -> (state) a 4 | algeff/effs3/main: () -> console () 5 | algeff/effs3/set: forall (x : a) -> (state) () 6 | algeff/effs3/state: forall (init : int, action : () -> |e> a) -> e a 7 | algeff/effs3/test: () -> (state) string -------------------------------------------------------------------------------- /test/algeff/effs4.kk.out: -------------------------------------------------------------------------------- 1 | positive 2 | 3 | algeff/effs4/get: forall () -> (state) a 4 | algeff/effs4/main: () -> console () 5 | algeff/effs4/set: forall (x : a) -> (state) () 6 | algeff/effs4/state: forall (() -> (state) b) -> ((s : a) -> b) 7 | algeff/effs4/test: () -> (state) string -------------------------------------------------------------------------------- /test/algeff/effs5.kk.out: -------------------------------------------------------------------------------- 1 | 0, 2, x, 2, x, 1, x 2 | 3 | algeff/effs5/amb: forall (() -> a) -> e list 4 | algeff/effs5/append: (x : string) -> state string 5 | algeff/effs5/flip: () -> amb bool 6 | algeff/effs5/get: () -> state string 7 | algeff/effs5/main: () -> console () 8 | algeff/effs5/state: forall (init : string, action : () -> a) -> e (a, string) 9 | algeff/effs5/test: () -> string -------------------------------------------------------------------------------- /test/algeff/effs5a.kk: -------------------------------------------------------------------------------- 1 | type mybool { 2 | MyFalse 3 | } 4 | effect ctl foo() : mybool 5 | effect val outer : string 6 | 7 | fun main() { 8 | with val outer = "outer" 9 | with rcontrol foo(){ rcontext.resume(MyFalse) } 10 | match(foo()) { 11 | MyFalse -> println("false") 12 | } 13 | } -------------------------------------------------------------------------------- /test/algeff/exn3.kk: -------------------------------------------------------------------------------- 1 | effect abort 2 | ctl abort() : a 3 | 4 | fun main() : total int 5 | with ctl abort() 42 6 | abort() 7 | 0 -------------------------------------------------------------------------------- /test/algeff/exn3.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/exn3/abort: forall () -> abort a 4 | algeff/exn3/main: () -> int -------------------------------------------------------------------------------- /test/algeff/issue305.kk: -------------------------------------------------------------------------------- 1 | import std/text/parse 2 | import std/core/undiv 3 | 4 | fun test(): parse char 5 | fun test2(): parse char 6 | char('r') 7 | pretend-no-div(test2) 8 | 9 | pub fun main() 10 | val code = "hi" 11 | val mb = parse(code.slice, test) 12 | println("success") 13 | -------------------------------------------------------------------------------- /test/algeff/issue305.kk.out: -------------------------------------------------------------------------------- 1 | success 2 | 3 | algeff/issuexxx/main: () -> console () 4 | algeff/issuexxx/test: () -> std/text/parse/parse char -------------------------------------------------------------------------------- /test/algeff/linear1.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/linear1/foo: () -> (state) int 4 | algeff/linear1/get: forall () -> (state) a 5 | algeff/linear1/main: () -> () 6 | algeff/linear1/put: forall (x : a) -> (state) () 7 | algeff/linear1/state: forall (init : a, action : () -> |e> int) -> int -------------------------------------------------------------------------------- /test/algeff/linear2.kk.out: -------------------------------------------------------------------------------- 1 | 68 2 | 3 | algeff/linear2/foo: () -> (state) int 4 | algeff/linear2/get: forall () -> (state) a 5 | algeff/linear2/main: () -> () 6 | algeff/linear2/put: forall (x : a) -> (state) () 7 | algeff/linear2/state: forall (init : a, action : () -> |e> int) -> int -------------------------------------------------------------------------------- /test/algeff/linear3.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/linear3/foo: () -> (state) int 4 | algeff/linear3/get: forall () -> (state) a 5 | algeff/linear3/main: () -> () 6 | algeff/linear3/put: forall (x : a) -> (state) () 7 | algeff/linear3/state: forall (init : a, action : () -> |e> int) -> int -------------------------------------------------------------------------------- /test/algeff/mask1.kk: -------------------------------------------------------------------------------- 1 | // issue #509 2 | 3 | effect reader 4 | fun ask() : s 5 | 6 | fun test( p : () -> , reader|e> a ) : e a 7 | with fun ask() 100 8 | with fun ask() 42 9 | p() 10 | 11 | pub fun main(): console () 12 | with test 13 | println(mask>(ask) : int) -------------------------------------------------------------------------------- /test/algeff/mask1.kk.out: -------------------------------------------------------------------------------- 1 | 100 2 | 3 | algeff/mask1/ask: forall () -> (reader) a 4 | algeff/mask1/main: () -> console () 5 | algeff/mask1/test: forall (p : () -> ,reader|e> a) -> e a -------------------------------------------------------------------------------- /test/algeff/noyield1.kk: -------------------------------------------------------------------------------- 1 | effect fun foo() : int 2 | effect fun bar() : int 3 | 4 | pub fun main() 5 | test().println 6 | 7 | pub fun test() : int 8 | with fun foo() 42 9 | with fun bar() foo() + 1 10 | foobar() 11 | 12 | fun foobar() : int 13 | with fun foo() 1 14 | bar() + foo() -------------------------------------------------------------------------------- /test/algeff/noyield1.kk.out: -------------------------------------------------------------------------------- 1 | 44 2 | 3 | algeff/noyield1/bar: () -> bar int 4 | algeff/noyield1/foo: () -> foo int 5 | algeff/noyield1/foobar: () -> bar int 6 | algeff/noyield1/main: () -> console () 7 | algeff/noyield1/test: () -> int -------------------------------------------------------------------------------- /test/algeff/noyield2.kk: -------------------------------------------------------------------------------- 1 | effect fun bar() : int 2 | effect fun foo(x:(),y:(),z:()) : int 3 | 4 | fun main() 5 | with fun bar() 1 6 | with fun foo(x,y,_z) 7 | //trace("hi") 8 | bar() 9 | val x = foo((),(),()) 10 | x.println 11 | -------------------------------------------------------------------------------- /test/algeff/noyield2.kk.out: -------------------------------------------------------------------------------- 1 | 1 2 | 3 | algeff/noyield2/bar: () -> bar int 4 | algeff/noyield2/foo: (x : (), y : (), z : ()) -> foo int 5 | algeff/noyield2/main: () -> console () -------------------------------------------------------------------------------- /test/algeff/open1.kk: -------------------------------------------------------------------------------- 1 | // test lifting of cps functions 2 | fun myid() : ((x:a) -> e a) { 3 | return fn(x){ x } 4 | } 5 | 6 | val hs : forall list e int> = [myid()] 7 | 8 | fun bar() { 9 | head(hs).default(id)(10) 10 | } 11 | 12 | fun main() { 13 | bar().show.println 14 | } -------------------------------------------------------------------------------- /test/algeff/open1.kk.out: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | algeff/open1/bar: () -> int 4 | algeff/open1/hs: forall list<(int) -> e int> 5 | algeff/open1/main: () -> console () 6 | algeff/open1/myid: forall () -> ((x : a) -> e a) -------------------------------------------------------------------------------- /test/algeff/open1a.kk: -------------------------------------------------------------------------------- 1 | // test lifting of cps functions 2 | // here the 'id' must first be lifted, but then is used 3 | // as non-cps 4 | 5 | val hs : forall list e int> = [id] 6 | 7 | fun bar(x:int) : int { 8 | head(hs).default(id)(x) 9 | } 10 | 11 | 12 | fun main() { 13 | bar(42).show.println 14 | } -------------------------------------------------------------------------------- /test/algeff/open1a.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/open1a/bar: (x : int) -> int 4 | algeff/open1a/hs: forall list<(int) -> e int> 5 | algeff/open1a/main: () -> console () -------------------------------------------------------------------------------- /test/algeff/open2.kk: -------------------------------------------------------------------------------- 1 | // test lifting of cps functions 2 | fun myid() : ((x:a) -> e a) { 3 | return fn(x){ x } 4 | } 5 | 6 | type func { 7 | Func (f : int -> e int) 8 | } 9 | 10 | val myfunc = Func(myid()) 11 | 12 | fun bar() { 13 | match(myfunc) { 14 | Func(f) -> f(42) 15 | } 16 | } 17 | 18 | fun main() { 19 | bar().show.println 20 | } -------------------------------------------------------------------------------- /test/algeff/open2.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/open2/func/f: forall (func : func) -> ((int) -> e int) 4 | algeff/open2/Func: forall (f : (int) -> e int) -> func 5 | algeff/open2/bar: () -> int 6 | algeff/open2/main: () -> console () 7 | algeff/open2/myfunc: forall func 8 | algeff/open2/myid: forall () -> ((x : a) -> e a) -------------------------------------------------------------------------------- /test/algeff/open3.kk: -------------------------------------------------------------------------------- 1 | // test lifting of cps functions 2 | 3 | fun mymap( f, xs ) { 4 | match(xs) { 5 | Nil -> Nil 6 | Cons(x,xx) -> Cons(f(x),mymap(f,xx)) 7 | } 8 | } 9 | 10 | fun myid(x) { 11 | x 12 | } 13 | 14 | fun test() { 15 | mymap(id,[42]) 16 | } 17 | 18 | fun main() { 19 | test().head.default(0).show.println 20 | } -------------------------------------------------------------------------------- /test/algeff/open3.kk.out: -------------------------------------------------------------------------------- 1 | 42 2 | 3 | algeff/open3/main: () -> console () 4 | algeff/open3/myid: forall (x : a) -> a 5 | algeff/open3/mymap: forall (f : (a) -> e b, xs : list) -> e list 6 | algeff/open3/test: () -> list -------------------------------------------------------------------------------- /test/algeff/open3a.kk: -------------------------------------------------------------------------------- 1 | // test lifting of cps functions 2 | 3 | fun mymap( f, xs ) { 4 | match(xs) { 5 | Nil -> Nil 6 | Cons(x,xx) -> Cons(f(x),mymap(f,xx)) 7 | } 8 | } 9 | 10 | fun myid(x) { 11 | x 12 | } 13 | 14 | fun test() { 15 | mymap(id,[42]) 16 | } 17 | 18 | fun main() { 19 | test().head.maybe(0).show.println 20 | } -------------------------------------------------------------------------------- /test/algeff/perf1.kk.flags: -------------------------------------------------------------------------------- 1 | --no-execute -------------------------------------------------------------------------------- /test/algeff/perf1a.kk.flags: -------------------------------------------------------------------------------- 1 | --no-execute -------------------------------------------------------------------------------- /test/algeff/perf2.kk.flags: -------------------------------------------------------------------------------- 1 | --no-execute -------------------------------------------------------------------------------- /test/algeff/rcontrol1.kk: -------------------------------------------------------------------------------- 1 | module rcontrol1 2 | 3 | effect amb { 4 | ctl flip() : bool 5 | } 6 | 7 | fun xor() : amb bool { 8 | val p = flip() 9 | val q = flip() 10 | (p||q) && not(p&&q) 11 | } 12 | 13 | val amb = handler { 14 | return(x){ [x] } 15 | rcontrol flip(){ rcontext.resume(False) ++ rcontext.resume(True) } 16 | } 17 | 18 | fun main() { 19 | amb(xor).show.println 20 | } 21 | -------------------------------------------------------------------------------- /test/algeff/rcontrol1.kk.out: -------------------------------------------------------------------------------- 1 | [False,True,True,False] 2 | 3 | algeff/rcontrol1/amb: forall (() -> a) -> e list 4 | algeff/rcontrol1/flip: () -> amb bool 5 | algeff/rcontrol1/main: () -> console () 6 | algeff/rcontrol1/xor: () -> amb bool -------------------------------------------------------------------------------- /test/algeff/scoped.flags: -------------------------------------------------------------------------------- 1 | --showtypesigs -e --no-checkcore 2 | -------------------------------------------------------------------------------- /test/algeff/scoped.kk.flags: -------------------------------------------------------------------------------- 1 | --no-checkcore 2 | -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec1.kk: -------------------------------------------------------------------------------- 1 | effect cow { 2 | ctl moo() : (() -> cow ()) 3 | } 4 | 5 | val cow = handler { 6 | ctl moo() { 7 | println("moo") 8 | resume( {moo()() } ) 9 | } 10 | } 11 | 12 | fun main() { 13 | cow { 14 | moo()() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec1.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/eff-rec1@kk(1, 1): kind error: Type cow is declared as being 2 | (co)inductive but it occurs recursively in a negative position@ 3 | hint: declare it as a divergent (or retractive) type using 'div type' (or 'div effect') to allow negative occurrences -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec1.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/eff-rec1.kk(1, 1): error: Type .ops-cow is declared as being (co)inductive but it occurs 2 | recursively in a negative position. 3 | hint: declare it as a 'type rec' (or 'effect rec)' to allow negative occurrences -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec2.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/eff-rec2@kk(39,32): type error: effects do not match 2 | context : fun main() : int { 3 | @@@ 4 | } 5 | term : { 6 | @@@ 7 | } 8 | inferred effect: 9 | expected effect: -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec3.kk: -------------------------------------------------------------------------------- 1 | 2 | effect state { 3 | fun get() : a 4 | fun set(x : a) : () 5 | } 6 | 7 | fun new-ref(init,action) { 8 | var s := init 9 | handle(action) 10 | fun get() { s } 11 | fun set(x) { s := x } 12 | } 13 | 14 | fun recurse() { 15 | with new-ref(id) 16 | fun foo(i : int) { 17 | get()(i) 18 | } 19 | set(foo) 20 | foo(42) 21 | } 22 | -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec3.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/eff-rec3@kk(17, 5): type error: types do not match (due to an infinite type) 2 | context : get()(i) 3 | term : get() 4 | inferred effect: _e1 _a>|_e> 5 | expected effect: _e1 6 | because : effect cannot be subsumed 7 | hint : give a type to the function definition? -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec4.kk: -------------------------------------------------------------------------------- 1 | 2 | effect state { 3 | fun get() : (int -> state int) 4 | fun set(x : int -> state int) : () 5 | } 6 | 7 | fun new-ref(init,action) { 8 | var s := init 9 | handle(action) 10 | fun get() { s } 11 | fun set(x) { s := x } 12 | } 13 | 14 | fun recurse() { 15 | with new-ref(id) 16 | fun foo(i : int) { 17 | get()(i) 18 | } 19 | set(foo) 20 | foo(42) 21 | } 22 | -------------------------------------------------------------------------------- /test/algeff/wrong/eff-rec4.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/eff-rec4@kk(2, 1): kind error: Type state is declared as being 2 | (co)inductive but it occurs recursively in a negative position@ 3 | hint: declare it as a divergent (or retractive) type using 'div type' (or 'div effect') to allow negative occurrences -------------------------------------------------------------------------------- /test/algeff/wrong/linear2.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/linear2@kk(19, 3): type error: handler for state needs to be linear but uses a non-linear effect: amb 2 | context: handle(action) 3 | fun get() { s } 4 | fun put(t) { if flip() then s := t; () } 5 | term : handle 6 | hint : ensure only linear effects are used in a handler -------------------------------------------------------------------------------- /test/algeff/wrong/mask1.kk: -------------------------------------------------------------------------------- 1 | // issue #509 2 | 3 | effect reader 4 | fun ask() : s 5 | 6 | fun test( p : () -> , reader|e> a ) : e a 7 | with fun ask() 100 8 | with fun ask() 42 9 | p() 10 | 11 | pub fun main(): console () 12 | with test 13 | println(mask>(ask()) : int) -------------------------------------------------------------------------------- /test/algeff/wrong/mask1.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/mask1@kk(13,29): type error: types do not match (due to an infinite type) 2 | context : mask>(ask() 3 | term : ask() 4 | inferred effect: _e int>|_e1> 5 | expected effect: _e 6 | because : inject expects a parameter-less function argument 7 | hint : give a type to the function definition? -------------------------------------------------------------------------------- /test/algeff/wrong/ops1.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/ops1@kk(45, 3): type error: operator flip is not part of the handled effect 2 | term : handle(action) { 3 | @@@ 4 | } 5 | inferred type: state -------------------------------------------------------------------------------- /test/algeff/wrong/ops4.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/ops4@kk(12, 3): type error: operator set is not handled -------------------------------------------------------------------------------- /test/algeff/wrong/ops5.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/ops5@kk(12, 3): type error: operator get is handled multiple times -------------------------------------------------------------------------------- /test/algeff/wrong/reject-mono.kk: -------------------------------------------------------------------------------- 1 | effect get-id { 2 | control get-id-op() : (a -> a) 3 | } 4 | 5 | fun test() { 6 | val f = get-id-op() 7 | if (f(1)==1) then (f(0) + 1) else 2 8 | } 9 | 10 | val h = handler { 11 | control get-id-op() { 12 | resume( fn(z){ resume( fn(w){ z }); z } ) 13 | } 14 | } 15 | 16 | fun main() { 17 | h(test) // 1 18 | } -------------------------------------------------------------------------------- /test/algeff/wrong/reject-poly.kk: -------------------------------------------------------------------------------- 1 | effect get-id { 2 | control get-id-op(): (a -> a) 3 | } 4 | 5 | fun test() { 6 | val f : forall a -> a = get-id-op() // can we generalize the get-id-op result $a -> $a ? 7 | if (f(True)) then (f(0) + 1) else 2 8 | } 9 | 10 | val h = handler { 11 | control get-id-op() { 12 | resume( fn(z){ resume( fn(w){ z }); z } ) 13 | } 14 | } 15 | 16 | fun main() { 17 | h(test) // 1 18 | } -------------------------------------------------------------------------------- /test/algeff/wrong/reject-poly2.kk: -------------------------------------------------------------------------------- 1 | effect get-id { 2 | control get-id-op() : (a -> a) 3 | } 4 | 5 | fun test() { 6 | val f : forall a -> a = get-id-op() 7 | if (f(True)) then (f(0) + 1) else 2 8 | } 9 | 10 | val h = handler { 11 | control get-id-op() { 12 | resume( fn(z){ resume( fn(w){ z }); z } ) 13 | } 14 | } 15 | 16 | fun main() { 17 | h(test) 18 | } -------------------------------------------------------------------------------- /test/algeff/wrong/scoped1.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/scoped1@kk(62, 7): type error: type is not polymorphic enough 2 | context : handler { 3 | @@@ 4 | } 5 | term : choice(xs) { 6 | @@@ 7 | } 8 | inferred type : forall clause1,b,nondet,|e1>,b> 9 | is less general than: forall clause1,b,nondet,|_e>,$a> 10 | hint : give a higher-rank type annotation to a function parameter? -------------------------------------------------------------------------------- /test/algeff/wrong/type1.kk: -------------------------------------------------------------------------------- 1 | 2 | effect amb { 3 | ctl flip() : bool 4 | } 5 | 6 | 7 | fun amb_handle() { 8 | handler { 9 | return(x) -> [x] 10 | ctl flip() -> [resume(False)] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/algeff/wrong/type1.kk.out: -------------------------------------------------------------------------------- 1 | test/algeff/wrong/type1@kk(10, 9): type error: types do not match (due to an infinite type) 2 | context : flip() -> [resume(False)] 3 | term : flip 4 | inferred type: (resume : (bool) -> _e list<_a>) -> _e list> 5 | expected type: ((bool) -> _e list>) -> _e list> 6 | hint : give a type to the function definition? -------------------------------------------------------------------------------- /test/async/async1.kk: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------- 2 | // Async demo 3 | // -------------------------------------------------------- 4 | import std/async 5 | import std/async/readline 6 | 7 | fun main() { 8 | println("what is your name?") 9 | val name = readline() 10 | println("and your age?") 11 | val age = readline() 12 | println("hi " ++ name ++ ", you are " ++ age) 13 | } -------------------------------------------------------------------------------- /test/async/async1.kk.out: -------------------------------------------------------------------------------- 1 | main : () -> () -------------------------------------------------------------------------------- /test/async/async1a.kk: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------- 2 | // Async demo 3 | // -------------------------------------------------------- 4 | import std/async 5 | import std/time/duration 6 | 7 | fun main() { 8 | println("wait 1") 9 | wait(1.seconds) 10 | println("wait 2") 11 | wait(1.seconds) 12 | println("wait 3") 13 | wait(1.seconds) 14 | println("done") 15 | } -------------------------------------------------------------------------------- /test/async/async2.kk.out: -------------------------------------------------------------------------------- 1 | [01;30moperator branch (amb) flip: resume scoped 2 | [00;39;49m[00m.Op-flip : .op-flip 3 | .Ops-flip : forall (flip : .op-flip) -> .ops-amb 4 | .tag-amb : string 5 | amb : forall (action : () -> a) -> e list 6 | flip : () -> amb bool 7 | main : () -> () 8 | test : () -> () -------------------------------------------------------------------------------- /test/async/async3.kk.out: -------------------------------------------------------------------------------- 1 | main : () -> () 2 | test : () -> () -------------------------------------------------------------------------------- /test/async/async4.kk.out: -------------------------------------------------------------------------------- 1 | main : () -> () 2 | test : () -> () -------------------------------------------------------------------------------- /test/async/async4a.kk.out: -------------------------------------------------------------------------------- 1 | main : () -> () -------------------------------------------------------------------------------- /test/async/async4b.kk.out: -------------------------------------------------------------------------------- 1 | main : () -> () 2 | test : () -> () -------------------------------------------------------------------------------- /test/async/async7.kk.out: -------------------------------------------------------------------------------- 1 | dowait : (s : std/time/duration/duration) -> string 2 | main : () -> () 3 | test : () -> () -------------------------------------------------------------------------------- /test/async/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "flags": "--showtypesigs", 3 | "exclude": ["async.*.kk"] 4 | } -------------------------------------------------------------------------------- /test/bench/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.hi 3 | *.o 4 | *.cmi 5 | *.cmx 6 | -------------------------------------------------------------------------------- /test/bench/koka/lookup-borrow.kk: -------------------------------------------------------------------------------- 1 | val n = 1000000 2 | val xs = list(1,n) 3 | 4 | fun lookup( ^xs : list, pred : a -> bool) : maybe 5 | match xs 6 | Cons(x,xx) -> if pred(x) then Just(x) else lookup(xx,pred) 7 | Nil -> Nothing 8 | 9 | pub fun main() 10 | repeat(1000) 11 | xs.lookup( fn(x) x == 0 ) 12 | () 13 | 14 | -------------------------------------------------------------------------------- /test/bench/koka/lookup-owned.kk: -------------------------------------------------------------------------------- 1 | val n = 1000000 2 | val xs = list(1,n) 3 | 4 | fun lookup( xs : list, pred : a -> bool) : maybe 5 | match xs 6 | Cons(x,xx) -> if pred(x) then Just(x) else lookup(xx,pred) 7 | Nil -> Nothing 8 | 9 | pub fun main() 10 | repeat(1000) 11 | xs.lookup( fn(x) x == 0 ) 12 | () 13 | 14 | -------------------------------------------------------------------------------- /test/bench/koka/tak-int.kk: -------------------------------------------------------------------------------- 1 | module tak-int 2 | 3 | pub fun tak(x : int, y : int, z : int ) : div int 4 | if y < x 5 | then tak( tak(x - 1, y, z), tak(y - 1, z, x), tak(z - 1, x, y) ) 6 | else z 7 | 8 | pub fun main() 9 | // tak(18,12,6).println 10 | tak(36,24,14).println -------------------------------------------------------------------------------- /test/bench/koka/tak.kk: -------------------------------------------------------------------------------- 1 | module tak 2 | 3 | import std/num/int32 4 | 5 | pub fun tak(x : int32, y : int32, z : int32 ) : div int32 6 | if y < x 7 | then tak( tak(x - 1.int32, y, z), tak(y - 1.int32, z, x), tak(z - 1.int32, x, y) ) 8 | else z 9 | 10 | pub fun main() 11 | // tak(18,12,6).println 12 | tak(36.int32,24.int32,14.int32).show.println -------------------------------------------------------------------------------- /test/bench/lean/leancompile.sh: -------------------------------------------------------------------------------- 1 | function run { 2 | echo $1 3 | $1 4 | } 5 | 6 | run "lean --c=$1.c $1" 7 | run "leanc -O3 -DNDEBUG -o lean-${1%.lean} $1.c" 8 | -------------------------------------------------------------------------------- /test/cgen/apply1.kk: -------------------------------------------------------------------------------- 1 | // tests codegeneration for parametersless fun (needs eta expansion in c# backend) 2 | fun foo() { 3 | 42 4 | } 5 | 6 | fun bar( action : () -> e int ) : e int { 7 | action() 8 | } 9 | 10 | fun main() { 11 | bar(foo) 12 | } -------------------------------------------------------------------------------- /test/cgen/assign1.kk: -------------------------------------------------------------------------------- 1 | struct counter( count : ref ) 2 | 3 | fun count( c : counter, assigned : int) : write () { 4 | c.counter/count.set(assigned) 5 | } 6 | 7 | fun main() { 8 | val c = Counter( count = ref(0) ) 9 | c.count := 1 10 | c.count.set := 2 11 | print(!(c.count)) 12 | } 13 | -------------------------------------------------------------------------------- /test/cgen/assign1.kk.out: -------------------------------------------------------------------------------- 1 | 2 -------------------------------------------------------------------------------- /test/cgen/box-int8.kk: -------------------------------------------------------------------------------- 1 | fun main() 2 | val v = vector-init(10) fn(i) i.int8 3 | v[0].int.println -------------------------------------------------------------------------------- /test/cgen/box-int8.kk.out: -------------------------------------------------------------------------------- 1 | 0 -------------------------------------------------------------------------------- /test/cgen/box1.kk: -------------------------------------------------------------------------------- 1 | type foo { 2 | Fun( f:a -> a) 3 | } 4 | 5 | fun foo() : foo { 6 | Fun(inc) 7 | } 8 | 9 | fun test() { 10 | match(foo()) { 11 | Fun(f) -> f(1) 12 | } 13 | } 14 | 15 | fun test2() { 16 | match([1]) { 17 | Cons(x) -> inc(x) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/cgen/box2.kk: -------------------------------------------------------------------------------- 1 | type foo { 2 | Fun( f:a -> a) 3 | } 4 | 5 | fun foo() : foo { 6 | Fun(inc) 7 | } 8 | 9 | fun test() { 10 | match(foo()) { 11 | Fun(f) -> f(1) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/cgen/box4.kk.out: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /test/cgen/comments1.kk: -------------------------------------------------------------------------------- 1 | // issue #594 2 | /* a /* b */ fun main () 1 */ 3 | fun main() 42 -------------------------------------------------------------------------------- /test/cgen/comments1.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/config.json: -------------------------------------------------------------------------------- 1 | "-e" 2 | -------------------------------------------------------------------------------- /test/cgen/ctail11.kk.out: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | [1,3,5,7,9] 12 | [2,4,6,8,10] -------------------------------------------------------------------------------- /test/cgen/ctail11a.kk.out: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | [1,3,5,7,9] 12 | [2,4,6,8,10] -------------------------------------------------------------------------------- /test/cgen/ctail2.kk: -------------------------------------------------------------------------------- 1 | 2 | fun mapx( xs : list, f : a -> e b ) : e list { 3 | match(xs) { 4 | Cons(x,xx) -> Cons(f(x),xx.mapx(f)) 5 | Nil -> Nil 6 | } 7 | } 8 | 9 | fun main() { 10 | list(1,10).mapx(fn(i){ i.println; i+1 }).sum.println 11 | } 12 | -------------------------------------------------------------------------------- /test/cgen/ctail2a.kk: -------------------------------------------------------------------------------- 1 | 2 | fun mapx( xs : list, f : a -> total b ) : total list { 3 | match(xs) { 4 | Cons(x,xx) -> Cons(f(x),xx.mapx(f)) 5 | Nil -> Nil 6 | } 7 | } 8 | 9 | fun main() { 10 | list(1,10).mapx(fn(i){ i+1 }).sum.println 11 | } 12 | -------------------------------------------------------------------------------- /test/cgen/ctail3.kk: -------------------------------------------------------------------------------- 1 | effect out { 2 | ctl out(s : string) : () 3 | } 4 | 5 | 6 | fun mapx( xs : list, f : a -> e b ) : e list { 7 | match(xs) { 8 | Cons(x,xx) -> Cons(f(x),xx.mapx(f)) 9 | Nil -> Nil 10 | } 11 | } 12 | 13 | fun main() { 14 | with ctl out(s:string) { 15 | println(s); resume(()) 16 | } 17 | list(1,10).mapx(fn(i:int){ if (i.is-odd) i.show.out; i+1 }).sum.println 18 | } 19 | -------------------------------------------------------------------------------- /test/cgen/ctail3a.kk: -------------------------------------------------------------------------------- 1 | effect out { 2 | fun out(s : string) : () 3 | } 4 | 5 | 6 | fun mapx( xs : list, f : a -> e b ) : e list { 7 | match(xs) { 8 | Cons(x,xx) -> Cons(f(x),xx.mapx(f)) 9 | Nil -> Nil 10 | } 11 | } 12 | 13 | fun main() { 14 | with fun out(s:string) { println(s) } 15 | list(1,10).mapx(fn(i:int){ if (i.is-odd) i.show.out; i+1 }).sum.println 16 | } 17 | -------------------------------------------------------------------------------- /test/cgen/ctail3b.kk: -------------------------------------------------------------------------------- 1 | effect out { 2 | fun out(s : string) : () 3 | } 4 | 5 | 6 | fun mapx( xs : list, f : a -> e b ) : e list { 7 | match(xs) { 8 | Cons(x,xx) -> Cons(f(x),xx.mapx(f)) 9 | Nil -> Nil 10 | } 11 | } 12 | 13 | fun main() { 14 | with fun out(s:string) { if s=="9" then throw(s); println(s) } 15 | list(1,10).mapx(fn(i:int){ if i.is-odd then i.show.out; i+1 }).sum.println 16 | } 17 | -------------------------------------------------------------------------------- /test/cgen/ctail7a.kk.out: -------------------------------------------------------------------------------- 1 | 2047 -------------------------------------------------------------------------------- /test/cgen/ctail7b.kk.out: -------------------------------------------------------------------------------- 1 | 2047 -------------------------------------------------------------------------------- /test/cgen/ctail7c.kk.out: -------------------------------------------------------------------------------- 1 | 11 -------------------------------------------------------------------------------- /test/cgen/ctail8.kk.out: -------------------------------------------------------------------------------- 1 | [1,3,5,7,9,11,13,15,17,19] -------------------------------------------------------------------------------- /test/cgen/dep1.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/dep2.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/eff-name.kk.out: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | Test name: Assertion -------------------------------------------------------------------------------- /test/cgen/external1.kk: -------------------------------------------------------------------------------- 1 | 2 | external inline foo( x : int ) : int { 3 | inline "#1" 4 | } 5 | 6 | fun main() { 7 | apply(foo,42) 8 | } 9 | -------------------------------------------------------------------------------- /test/cgen/external2.kk: -------------------------------------------------------------------------------- 1 | 2 | external inline foo( x : int ) : exn int { 3 | inline "#1" 4 | } 5 | 6 | fun main() { 7 | foo(42) 8 | print("done") 9 | } 10 | -------------------------------------------------------------------------------- /test/cgen/external3.kk: -------------------------------------------------------------------------------- 1 | 2 | external inline foo( x : int ) : exn int { 3 | inline "#1" 4 | } 5 | 6 | fun main() { 7 | [42].map(foo).head 8 | } 9 | -------------------------------------------------------------------------------- /test/cgen/external4.kk: -------------------------------------------------------------------------------- 1 | 2 | external inline foo( x : int ) : exn int { 3 | inline "#1" 4 | } 5 | 6 | fun main() { 7 | zipWith([12],[30],(+)).head 8 | } 9 | -------------------------------------------------------------------------------- /test/cgen/field1.kk: -------------------------------------------------------------------------------- 1 | struct num 2 | (+) : ( x : a, y : a ) -> a 3 | (*) : (a,a) -> a 4 | 5 | val int/num : num 6 | = Num( (+), (*) ) 7 | 8 | pub fun main() 9 | (num.(+))(1,2).println -------------------------------------------------------------------------------- /test/cgen/field1.kk.out: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/cgen/hidden1.kk: -------------------------------------------------------------------------------- 1 | module hidden1 2 | 3 | // Had an issue where hidden names of operators were creating invalid identifiers for parsing the kki files. 4 | pub fun (+++)(l: list, x: int): list 5 | match l 6 | Cons(n, rs) -> Cons(n + x, rs +++ x) 7 | Nil -> Nil -------------------------------------------------------------------------------- /test/cgen/hidden2.kk: -------------------------------------------------------------------------------- 1 | module hidden2 2 | 3 | import hidden1 4 | 5 | pub fun main() 6 | ([0, 1, 2, 3] +++ 1).show.println -------------------------------------------------------------------------------- /test/cgen/higherkind0.kk: -------------------------------------------------------------------------------- 1 | fun idp( x : c ) : c { x } 2 | 3 | fun main() { Cons(1,idp([1])) } 4 | -------------------------------------------------------------------------------- /test/cgen/higherkind0.kk.out: -------------------------------------------------------------------------------- 1 | [1,1] -------------------------------------------------------------------------------- /test/cgen/higherkind1.kk: -------------------------------------------------------------------------------- 1 | fun bar( f : forall ( x:c,y:a) -> list ) { 2 | f([2],1) 3 | } 4 | 5 | fun foo( x:a,y:b ) : list { 6 | [y] 7 | } 8 | 9 | fun main() { bar(foo) } 10 | -------------------------------------------------------------------------------- /test/cgen/higherkind1.kk.out: -------------------------------------------------------------------------------- 1 | [1] -------------------------------------------------------------------------------- /test/cgen/higherkind2.kk: -------------------------------------------------------------------------------- 1 | type eq { 2 | con Eq( witness : forall f -> f ) 3 | } 4 | 5 | fun idp( x : c ) : c { x } 6 | fun foo( x : eq ) { 42 } 7 | 8 | fun main() { foo(Eq(id)) } 9 | -------------------------------------------------------------------------------- /test/cgen/higherkind2.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/higherkind3.kk: -------------------------------------------------------------------------------- 1 | // The current C-sharp translation does not support 'nested' polymorphic higher kinds 2 | fun foo( xs : list> ) { 1 } 3 | 4 | fun main() { 5 | foo(single(single(1))) 6 | } -------------------------------------------------------------------------------- /test/cgen/host.kk: -------------------------------------------------------------------------------- 1 | fun main() 2 | host() == "libc" -------------------------------------------------------------------------------- /test/cgen/host.kk.out: -------------------------------------------------------------------------------- 1 | True -------------------------------------------------------------------------------- /test/cgen/javascript.kk.out: -------------------------------------------------------------------------------- 1 | 3test/cgen/javascript@kk(84, 3): type warning: Some branches in the match will never be reached: _ -------------------------------------------------------------------------------- /test/cgen/localrec1.kk: -------------------------------------------------------------------------------- 1 | /* 2 | fun my-show-list( xs : list, show-elem : (a) -> e string ) : e string 3 | { 4 | "[" ++ xs.map(show-elem).join(",") ++ "]" 5 | } 6 | */ 7 | 8 | fun main(x : int) 9 | fun f(i:int) 10 | fun g(j:int) 11 | fun h(k:int) 12 | if k==0 then x+k else h(k - 1) 13 | if j==0 then h(i+x) else g(j - 1) 14 | if i==x then g(i) else f(i - 1) 15 | f(x+1) 16 | -------------------------------------------------------------------------------- /test/cgen/monad1.kk: -------------------------------------------------------------------------------- 1 | struct monad 2 | pure : forall a -> m 3 | bind : forall (m, a -> m) -> m 4 | 5 | 6 | //fun sequence( ms : list>, ?monad : monad ) : m> 7 | fun sequence( xs, ?m:monad<_> ) 8 | match xs 9 | Nil -> m.pure.([]) 10 | Cons(mx,mxx) -> 11 | with x <- m.bind.(mx) 12 | with xx <- m.bind.(sequence(mxx)) 13 | m.pure.(Cons(x,xx)) 14 | -------------------------------------------------------------------------------- /test/cgen/monadic2.kk: -------------------------------------------------------------------------------- 1 | effect reader { 2 | fun read() : int 3 | } 4 | 5 | fun foo() : reader int { 6 | fun bar( y : int ) : reader int { 7 | return y 8 | } 9 | val x = bar(19) 10 | x + 1 11 | } 12 | -------------------------------------------------------------------------------- /test/cgen/mutual1.kk: -------------------------------------------------------------------------------- 1 | // mutual recursive functions (issue #596) 2 | 3 | fun foo() 4 | bar() 5 | 6 | fun bar() 7 | foo() 8 | 9 | fun main() 10 | () -------------------------------------------------------------------------------- /test/cgen/mutual1.kk.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/test/cgen/mutual1.kk.out -------------------------------------------------------------------------------- /test/cgen/open0.kk: -------------------------------------------------------------------------------- 1 | type open test { 2 | X 3 | } 4 | 5 | type extend test { 6 | Y 7 | } 8 | 9 | fun test(x) { 10 | match(x) { 11 | Y -> println("its a Y") 12 | } 13 | } 14 | 15 | fun main() { 16 | test(Y) 17 | } -------------------------------------------------------------------------------- /test/cgen/open1.kk: -------------------------------------------------------------------------------- 1 | open type test { 2 | A 3 | } 4 | 5 | extend type test { 6 | B(i : int) 7 | } 8 | 9 | extend type test { 10 | C(j : int) 11 | } 12 | 13 | fun foo(t) { 14 | match(t) { 15 | B(i) -> i 16 | _ -> 42 17 | } 18 | } 19 | 20 | fun main() { 21 | foo(C(2)).print 22 | } -------------------------------------------------------------------------------- /test/cgen/open1.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/open1a.kk: -------------------------------------------------------------------------------- 1 | module open1a 2 | 3 | import open0 4 | 5 | val theY = open0/Y 6 | val theX = open0/X 7 | 8 | extend type test { 9 | X 10 | } 11 | 12 | fun test( x : test ) { 13 | match(x) { 14 | open0/X -> "original X" 15 | open1a/X -> "the new X" 16 | } 17 | } 18 | 19 | fun main() { 20 | open1a/test(theX).print 21 | open1a/test(open1a/X).print 22 | } -------------------------------------------------------------------------------- /test/cgen/open3.kk: -------------------------------------------------------------------------------- 1 | open type test { 2 | X 3 | } 4 | 5 | extend type test { 6 | Y 7 | } 8 | 9 | fun test(x) { 10 | match(x) { 11 | Y -> println("its a Y") 12 | } 13 | } 14 | 15 | fun main() { 16 | test(Y).print 17 | } -------------------------------------------------------------------------------- /test/cgen/open4.kk.out: -------------------------------------------------------------------------------- 1 | Nothing 2 | Just(C) 3 | Just(C) -------------------------------------------------------------------------------- /test/cgen/pat1.kk: -------------------------------------------------------------------------------- 1 | import std/num/int64 2 | 3 | fun test( x : int = 42, y : int64 = 0.int64) 4 | 2*x+y.int -------------------------------------------------------------------------------- /test/cgen/rec1.kk: -------------------------------------------------------------------------------- 1 | fun foo() { 2 | 42 3 | } 4 | 5 | fun bar( action : () -> e int ) : e int { 6 | action() 7 | } 8 | 9 | fun main() { 10 | bar(foo) 11 | } -------------------------------------------------------------------------------- /test/cgen/rec1.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/rec2.kk: -------------------------------------------------------------------------------- 1 | // polymorphic recursion 2 | fun foo(xs:list, n:int) : _ int 3 | { 4 | if (n==0) then 1 else foo(single(xs),n - 1) 5 | } 6 | 7 | fun main() { foo(single(1),2) } -------------------------------------------------------------------------------- /test/cgen/rec2.kk.out: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /test/cgen/rec3.kk: -------------------------------------------------------------------------------- 1 | // polymorphic recursion on a dynamic closure 2 | fun bar(ys,m) { 3 | fun foo(xs:list, n:int) : _ int 4 | { 5 | if (n==0) then m else foo(single(xs),n - 1) 6 | } 7 | 8 | return foo(ys,m) 9 | } 10 | 11 | fun main() { print(bar([],1)) } -------------------------------------------------------------------------------- /test/cgen/rec3.kk.out: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /test/cgen/rec4.kk: -------------------------------------------------------------------------------- 1 | fun foo(xs,n) { 2 | fun bar(xs : list) { 3 | match(xs) { 4 | Cons(_x,xx) -> bar(xx); 5 | Nil -> n 6 | } 7 | }; 8 | bar(xs) 9 | } 10 | 11 | 12 | fun main() { print(foo([],1)) } 13 | -------------------------------------------------------------------------------- /test/cgen/rec4.kk.out: -------------------------------------------------------------------------------- 1 | 1test/cgen/rec4@kk(2,13): type warning: xs shadows an earlier local definition or parameter -------------------------------------------------------------------------------- /test/cgen/rec4a.kk: -------------------------------------------------------------------------------- 1 | fun foo(xs,n) { 2 | fun bar(xs) { 3 | match(xs) { 4 | Cons(_x,xx) -> bar(xx); 5 | Nil -> n 6 | } 7 | }; 8 | bar(xs) 9 | } 10 | 11 | 12 | fun main() { print(foo([],1)) } 13 | -------------------------------------------------------------------------------- /test/cgen/rec4a.kk.out: -------------------------------------------------------------------------------- 1 | 1test/cgen/rec4a@kk(2,13): type warning: xs shadows an earlier local definition or parameter -------------------------------------------------------------------------------- /test/cgen/rec5.kk: -------------------------------------------------------------------------------- 1 | fun foo(xs,n) { 2 | fun bar(xs) { 3 | match(xs) { 4 | // cons(x,xx) -> bar(xx); 5 | Nil -> n 6 | } 7 | }; 8 | bar(xs) 9 | } 10 | 11 | 12 | fun main() { print(foo([],1)) } -------------------------------------------------------------------------------- /test/cgen/rec5.kk.out: -------------------------------------------------------------------------------- 1 | 1test/cgen/rec5@kk(2,13): type warning: xs shadows an earlier local definition or parameter -------------------------------------------------------------------------------- /test/cgen/return1.kk: -------------------------------------------------------------------------------- 1 | 2 | fun foo() { 3 | if (True && False) return 1 4 | 42 5 | } 6 | 7 | fun main() { 8 | foo().print 9 | } 10 | -------------------------------------------------------------------------------- /test/cgen/return1.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/return2.kk: -------------------------------------------------------------------------------- 1 | 2 | fun foo() { 3 | val x = if (True && False) return () 4 | x 5 | } 6 | 7 | fun main() { 8 | foo().show.print 9 | } 10 | -------------------------------------------------------------------------------- /test/cgen/return2.kk.out: -------------------------------------------------------------------------------- 1 | () -------------------------------------------------------------------------------- /test/cgen/return3.kk: -------------------------------------------------------------------------------- 1 | 2 | fun foo() { 3 | val x = if (True || False) then 42 else return 32 4 | x 5 | } 6 | 7 | fun main() { 8 | foo().print 9 | } 10 | -------------------------------------------------------------------------------- /test/cgen/return3.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/return4.kk: -------------------------------------------------------------------------------- 1 | 2 | fun foo() { 3 | if (True || False) then return 42 4 | 0 5 | } 6 | 7 | fun main() { 8 | foo().print 9 | } 10 | -------------------------------------------------------------------------------- /test/cgen/return4.kk.out: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /test/cgen/return5.kk.out: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/cgen/return6.kk: -------------------------------------------------------------------------------- 1 | // issue #643 2 | fun test(c: char): maybe 3 | val c1 = 4 | match f(c) 5 | Just(c1) -> 6 | c1 7 | Nothing -> 8 | return Nothing // or `return test(c)` 9 | 10 | Just(c1) 11 | 12 | fun f(c: char): maybe 13 | val x = match Just(c) 14 | Just(_cx) -> return Nothing 15 | Nothing -> Just(c) 16 | x 17 | 18 | fun main() 19 | () -------------------------------------------------------------------------------- /test/cgen/return6.kk.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koka-lang/koka/c9c313f09cc10c24386f97f3d80a22f3f132baed/test/cgen/return6.kk.out -------------------------------------------------------------------------------- /test/cgen/returnscrut.kk.out: -------------------------------------------------------------------------------- 1 | Compiled -------------------------------------------------------------------------------- /test/cgen/reused-names.kk.out: -------------------------------------------------------------------------------- 1 | [[0,1,2,3],[]] -------------------------------------------------------------------------------- /test/cgen/shortcircuit1.kk.out: -------------------------------------------------------------------------------- 1 | b = True 2 | True 3 | b = True 4 | True -------------------------------------------------------------------------------- /test/cgen/spec1.kk: -------------------------------------------------------------------------------- 1 | fun test-many() 2 | var i := 0 3 | for(1,10000000) fn(j) 4 | i := i + 1 5 | println(i) 6 | 7 | 8 | fun main() 9 | test-many() 10 | -------------------------------------------------------------------------------- /test/cgen/specialize-map6.kk: -------------------------------------------------------------------------------- 1 | 2 | fun test(xs : list<_>, f, g) : total list<_> { 3 | xs.map( fn(x){ f(g(x))} ) // free variable 4 | } 5 | 6 | pub fun main() { 7 | list(1,10).test(fn(x){x*2},inc).sum.println 8 | } 9 | -------------------------------------------------------------------------------- /test/cgen/specialize-showlist.kk: -------------------------------------------------------------------------------- 1 | fun show(xs : list<(int,list)>) : string 2 | xs.show-list fn(x) 3 | "(state=" ++ x.fst.show ++ ", " ++ x.snd.show ++ ")" 4 | 5 | fun main() 6 | val xss = [(1,[1,2]),(2,[3,4,5]),(3,[])] 7 | xss.show.println 8 | -------------------------------------------------------------------------------- /test/cgen/specialize/branch.kk.out: -------------------------------------------------------------------------------- 1 | 2 2 | 1 3 | 2 4 | 5 5 | 6 | cgen/specialize/branch/@lift-xxx: (list) -> console () 7 | cgen/specialize/branch/@lift-xxx: (list) -> console () 8 | cgen/specialize/branch/@lift-xxx: forall<_e> (list) -> list 9 | cgen/specialize/branch/main: () -> console () 10 | cgen/specialize/branch/map_other: forall (xs : list, f : (a) -> b, g : (a) -> b) -> list -------------------------------------------------------------------------------- /test/cgen/specialize/config.json: -------------------------------------------------------------------------------- 1 | "-e --showhiddentypesigs --fno-trmc -O1 --core" 2 | -------------------------------------------------------------------------------- /test/cgen/specialize/fold1.kk: -------------------------------------------------------------------------------- 1 | fun foo(f) { 2 | list(1,10).foldl( 0, f ) 3 | } 4 | 5 | fun bar(f) { 6 | list(1,10).foldl1(f) 7 | } 8 | 9 | fun main() { 10 | // specializes 11 | list(1,10).foldl(0, (+)).show.println 12 | // this seems to specialize if the next call to bar is commented 13 | foo((+)).show.println 14 | // does not specialize; check if fold1 is specializable 15 | bar((+)).show.println 16 | } -------------------------------------------------------------------------------- /test/cgen/specialize/fold2.kk: -------------------------------------------------------------------------------- 1 | fun main() { 2 | list(1,10).foldr( 0, (+) ).println 3 | } -------------------------------------------------------------------------------- /test/cgen/specialize/fold2.kk.out: -------------------------------------------------------------------------------- 1 | 55 2 | 3 | cgen/specialize/fold2/@lift-xxx: (list, int) -> console int 4 | cgen/specialize/fold2/@lift-xxx: (list, int) -> console int 5 | cgen/specialize/fold2/main: () -> console () -------------------------------------------------------------------------------- /test/cgen/specialize/map-alias.kk: -------------------------------------------------------------------------------- 1 | fun map2(xs : list<_>, f) { 2 | map(xs, f) 3 | } 4 | 5 | fun map3(xs : list<_>, f) { 6 | map2(xs, f) 7 | } 8 | 9 | fun main() { 10 | [1,2,3].map3(fn(x) { x + 1 }).show.println 11 | } -------------------------------------------------------------------------------- /test/cgen/specialize/map.kk: -------------------------------------------------------------------------------- 1 | fun map-int(xs : list, f : int -> int) : list { 2 | match (xs) { 3 | Nil -> Nil 4 | Cons(x, xx) -> Cons(x.f, xx.map-int(f)) 5 | } 6 | } 7 | 8 | pub fun test() { 9 | [1,2,3].map-int(fn(x){ x + 1 }) 10 | } 11 | 12 | pub fun main() { 13 | test().show.println 14 | } 15 | -------------------------------------------------------------------------------- /test/cgen/specialize/map2.kk: -------------------------------------------------------------------------------- 1 | fun map-int(xs : list, f : int -> int) : list { 2 | match (xs) { 3 | Nil -> Nil 4 | Cons(x, xx) -> Cons(x.f, xx.map-int(f)) 5 | } 6 | } 7 | 8 | pub fun test(y : int) { 9 | [1,2,3].map-int(fn(x){ x + y }) // free variable 10 | } 11 | 12 | pub fun main() { 13 | test(2).show.println 14 | } 15 | -------------------------------------------------------------------------------- /test/cgen/specialize/map3.kk: -------------------------------------------------------------------------------- 1 | fun map-poly(xs : list, f : a -> e b) : e list { 2 | match (xs) { 3 | Nil -> Nil 4 | Cons(x, xx) -> Cons(x.f, xx.map-poly(f)) 5 | } 6 | } 7 | 8 | pub fun test(xs : list, y : int) { 9 | xs.map-poly(fn(x){ x + y }) // free variable 10 | } 11 | 12 | pub fun main() { 13 | list(1,10).test(5).show.println 14 | } 15 | -------------------------------------------------------------------------------- /test/cgen/specialize/map4.kk: -------------------------------------------------------------------------------- 1 | 2 | fun map-poly(xs : list, f : a -> e b) : e list { 3 | match (xs) { 4 | Nil -> Nil 5 | Cons(x, xx) -> Cons(x.f, xx.map-poly(f)) 6 | } 7 | } 8 | 9 | pub fun test(xs : list, y : int, g : a -> int) { 10 | xs.map-poly(fn(x){ g(x) + y }) // free variable 11 | } 12 | 13 | pub fun main() { 14 | list(1,10).test(5, fn(x){ x*2 }).sum.println 15 | } 16 | -------------------------------------------------------------------------------- /test/cgen/specialize/map5.kk: -------------------------------------------------------------------------------- 1 | 2 | pub fun test(xs : list, y : int, f : a -> int) { 3 | xs.map(fn(x){ f(x) + y }) // free variable 4 | } 5 | 6 | pub fun main() { 7 | list(1,10).test(5, inc).sum.println 8 | } 9 | -------------------------------------------------------------------------------- /test/cgen/specialize/maptwice.kk: -------------------------------------------------------------------------------- 1 | inline fun maptwice(f : int -> _) : total list> { 2 | [[1,2,3]].map(fn(xs) xs.map(f)) 3 | } 4 | 5 | fun main() { 6 | maptwice(inc)[0].unjust[0].unjust.println 7 | } -------------------------------------------------------------------------------- /test/cgen/specialize/sieve.kk: -------------------------------------------------------------------------------- 1 | fun sieve(xs : list, max : int ) : div list 2 | match xs 3 | Nil -> Nil 4 | Cons(x,xx) -> if x*x > max then xx 5 | else Cons(x, xx.filter(fn(y) y%x != 0).sieve(max)) 6 | 7 | fun gen-primes(n : int) : div list 8 | list(2,n).sieve(n) 9 | 10 | fun test(n) 11 | gen-primes(n).foreach(fn(x) println(x)) 12 | 13 | fun main() 14 | test(100) -------------------------------------------------------------------------------- /test/cgen/specialize/twostep-large.kk: -------------------------------------------------------------------------------- 1 | fun large(f : int -> _ _) : total _ { 2 | list(1, 10, f).sum 3 | } 4 | 5 | fun calls-large(f) { 6 | large(f).println 7 | large(f).println 8 | } 9 | 10 | fun main() { 11 | calls-large() fn(x) { 12 | x + 2 13 | } 14 | } -------------------------------------------------------------------------------- /test/cgen/specialize/while.kk: -------------------------------------------------------------------------------- 1 | fun countdown(n_ : int) : _ () 2 | var n := n_ 3 | while { n > 0 } 4 | n.println 5 | n := n - 1 6 | 7 | 8 | fun main() { 9 | countdown(10) 10 | } -------------------------------------------------------------------------------- /test/cgen/specialize/while.kk.out: -------------------------------------------------------------------------------- 1 | 10 2 | 9 3 | 8 4 | 7 5 | 6 6 | 5 7 | 4 8 | 3 9 | 2 10 | 1 11 | 12 | cgen/specialize/while/@lift-xxx: forall (n : local-var) -> ,console> () 13 | cgen/specialize/while/countdown: (n_ : int) -> () 14 | cgen/specialize/while/main: () -> () -------------------------------------------------------------------------------- /test/cgen/tail.kk.out: -------------------------------------------------------------------------------- 1 | 0@25 -------------------------------------------------------------------------------- /test/cgen/tail2.kk: -------------------------------------------------------------------------------- 1 | import tail 2 | 3 | pub fun main() 4 | tail/main() -------------------------------------------------------------------------------- /test/cgen/tail2.kk.out: -------------------------------------------------------------------------------- 1 | 0@25 -------------------------------------------------------------------------------- /test/cgen/trace1.kk: -------------------------------------------------------------------------------- 1 | 2 | fun main() { 3 | trace("hi") 4 | println("done") 5 | } 6 | -------------------------------------------------------------------------------- /test/cgen/unicode1.kk.out: -------------------------------------------------------------------------------- 1 | count: 13, sub3: x☃x, rev3: x☃x, 2 | s: x☃x (snowman), [0x78,0x2603,0x78,0x20,0x28,0x73,0x6E,0x6F,0x77,0x6D,0x61,0x6E,0x29] 3 | count: 13, sub3: x💪x, rev3: x💪x, 4 | s: x💪x (astral ), [0x78,0x1F4AA,0x78,0x20,0x28,0x61,0x73,0x74,0x72,0x61,0x6C,0x20,0x29] 5 | count: 13, sub3: x𝐀x, rev3: x𝐀x, 6 | s: x𝐀x (math A ), [0x78,0x1D400,0x78,0x20,0x28,0x6D,0x61,0x74,0x68,0x20,0x41,0x20,0x29] -------------------------------------------------------------------------------- /test/cgen/unicode2.kk.out: -------------------------------------------------------------------------------- 1 | count: 6, sub3: aña, rev3: aña, 2 | s: mañana, [0x6D,0x61,0xF1,0x61,0x6E,0x61] 3 | count: 7, sub3: añ, rev3: ña, 4 | s: mañana, [0x6D,0x61,0x6E,0x303,0x61,0x6E,0x61] 5 | count: 6, sub3: ̣̇x, rev3: ̣̇x, 6 | s: ẋ̣xyz, [0x78,0x307,0x323,0x78,0x79,0x7A] -------------------------------------------------------------------------------- /test/cgen/vector1.kk: -------------------------------------------------------------------------------- 1 | pub fun vector/append(first : vector, second : vector) : _ vector 2 | vector-init(first.length + second.length, fn(i) index-two(first, second, i)) 3 | 4 | fun vector/index-two(first : vector, second : vector, i: int) : _ a 5 | if i < first.length then first[i] else second[i] 6 | 7 | pub fun main() 8 | val x = [1,2,3].vector 9 | val y = x.append(x) 10 | () -------------------------------------------------------------------------------- /test/cgen/vector1.kk.out: -------------------------------------------------------------------------------- 1 | uncaught exception: index out of bounds -------------------------------------------------------------------------------- /test/cgen/wrong/assign1.kk: -------------------------------------------------------------------------------- 1 | struct counter( count : ref ) 2 | 3 | 4 | fun test() { 5 | val c = Counter( count = ref(0) ) 6 | c.count := 1 7 | print(!c.count) 8 | } 9 | -------------------------------------------------------------------------------- /test/cgen/wrong/ctail7.kk: -------------------------------------------------------------------------------- 1 | // Tail recursion on a field in a value type. 2 | type tree 3 | Tip 4 | Node( lr : maybe<(tree,tree)> ) 5 | 6 | 7 | fun make( depth : int ) : div tree 8 | if depth > 0 9 | then Node( Just((make(depth.dec), make(depth.dec))) ) 10 | else Node( Just((Tip, Tip)) ) 11 | -------------------------------------------------------------------------------- /test/cgen/wrong/exists1.kk.out: -------------------------------------------------------------------------------- 1 | test/cgen/wrong/exists1@kk(18,27): type error: True does not match the argument types 2 | context : True 3 | term : True 4 | inferred type: bool 5 | expected type: $a -------------------------------------------------------------------------------- /test/cgen/wrong/exists1a.kk.out: -------------------------------------------------------------------------------- 1 | test/cgen/wrong/exists1a@kk(18,19): type error: abstract types do not match 2 | context : x@eval 3 | term : x 4 | inferred type: expr<$b> 5 | expected type: expr<$a> 6 | hint : an higher-rank type escapes its scope? -------------------------------------------------------------------------------- /test/cgen/wrong/rec2.kk: -------------------------------------------------------------------------------- 1 | // polymorphic recursion but without a type signature: should be rejected??? 2 | fun foo(xs,n) 3 | { 4 | if (n==0) then 1 else foo(single(xs),n - 1) 5 | } 6 | 7 | fun main() { foo(single(1),2) } -------------------------------------------------------------------------------- /test/cgen/wrong/recval.kk: -------------------------------------------------------------------------------- 1 | val x = x 2 | 3 | fun main() { } -------------------------------------------------------------------------------- /test/cgen/wrong/recval.kk.out: -------------------------------------------------------------------------------- 1 | test/cgen/wrong/recval@kk(1, 5): type error: value definition is recursive@ 2 | recursive group: [cgen/wrong/recval/x] -------------------------------------------------------------------------------- /test/finally/config.json: -------------------------------------------------------------------------------- 1 | "--showtypesigs -e" 2 | -------------------------------------------------------------------------------- /test/finally/finally1.kk.out: -------------------------------------------------------------------------------- 1 | action 2 | finally 3 | return 4 | 42 5 | 6 | finally/finally1/bar: () -> console int 7 | finally/finally1/foo: () -> console int 8 | finally/finally1/main: () -> console () -------------------------------------------------------------------------------- /test/finally/finally1a.kk: -------------------------------------------------------------------------------- 1 | // Test finally 2 | 3 | fun bar() { 4 | println("action") 5 | throw("ouch") 6 | 42 7 | } 8 | 9 | fun foo() 10 | { 11 | with return(x) { println("return"); x } 12 | with finally { println("finally") } 13 | bar() 14 | } 15 | 16 | fun main() { 17 | foo().println 18 | } 19 | -------------------------------------------------------------------------------- /test/finally/finally1a.kk.out: -------------------------------------------------------------------------------- 1 | action 2 | finally 3 | uncaught exception: ouch 4 | 5 | finally/finally1a/bar: () -> int 6 | finally/finally1a/foo: () -> int 7 | finally/finally1a/main: () -> () -------------------------------------------------------------------------------- /test/finally/finally2.kk.out: -------------------------------------------------------------------------------- 1 | action: 42 2 | return, local: 42 3 | finally, local: 42 4 | 42 5 | 6 | finally/finally2/bar: () -> int 7 | finally/finally2/foo: () -> console int 8 | finally/finally2/inc: () -> state int 9 | finally/finally2/main: () -> console () -------------------------------------------------------------------------------- /test/finally/finally2a.kk.out: -------------------------------------------------------------------------------- 1 | action: 42 2 | finally, local: 42 3 | raised: ouch 4 | exc finalize 5 | 6 | finally/finally2a/bar: () -> int 7 | finally/finally2a/foo: () -> int 8 | finally/finally2a/inc: () -> state int 9 | finally/finally2a/main: () -> console () 10 | finally/finally2a/raise: forall (s : string) -> exc a -------------------------------------------------------------------------------- /test/finally/finally2b.kk.out: -------------------------------------------------------------------------------- 1 | finally, local: 41 2 | result: 43 3 | exc finalize 4 | 5 | finally/finally2b/bar: () -> int 6 | finally/finally2b/foo: () -> int 7 | finally/finally2b/inc: () -> state int 8 | finally/finally2b/main: () -> console () 9 | finally/finally2b/raise: forall (s : string) -> exc a -------------------------------------------------------------------------------- /test/finally/finally3.kk.out: -------------------------------------------------------------------------------- 1 | action: 43 2 | finally, local: 43 3 | return, local: 43 4 | 42 5 | 6 | finally/finally3/bar: () -> int 7 | finally/finally3/foo: () -> console int 8 | finally/finally3/inc: () -> inc int 9 | finally/finally3/main: () -> console () -------------------------------------------------------------------------------- /test/finally/finally3a.kk.out: -------------------------------------------------------------------------------- 1 | action: 42 2 | finally, local: 43 3 | exc finalize 4 | raised: ouch 5 | 6 | finally/finally3a/bar: () -> int 7 | finally/finally3a/foo: () -> int 8 | finally/finally3a/inc: () -> inc int 9 | finally/finally3a/main: () -> console () 10 | finally/finally3a/raise: forall (msg : string) -> raise a -------------------------------------------------------------------------------- /test/finally/finally3b.kk.out: -------------------------------------------------------------------------------- 1 | action: 42 2 | raised: ouch 3 | finally, local: 43 4 | exc finalize 5 | 6 | finally/finally3b/bar: () -> int 7 | finally/finally3b/foo: () -> int 8 | finally/finally3b/inc: () -> inc int 9 | finally/finally3b/main: () -> console () 10 | finally/finally3b/raise: forall (msg : string) -> raise a -------------------------------------------------------------------------------- /test/finally/finally4.kk: -------------------------------------------------------------------------------- 1 | // see issue #360 2 | effect ctl myeffect() : () 3 | 4 | fun main() : () 5 | with finally 6 | println("top") 7 | with ctl myeffect() () 8 | with finally 9 | println("mid") 10 | with ctl myeffect() myeffect() 11 | with finally 12 | println("cleanup") 13 | myeffect() -------------------------------------------------------------------------------- /test/finally/finally4.kk.out: -------------------------------------------------------------------------------- 1 | cleanup 2 | mid 3 | top 4 | 5 | finally/finally4/main: () -> console () 6 | finally/finally4/myeffect: () -> myeffect () -------------------------------------------------------------------------------- /test/finally/initially1.kk.out: -------------------------------------------------------------------------------- 1 | initially: 0 2 | action 3 | return, local=42 4 | finally, local=42 5 | 42 6 | 7 | finally/initially1/bar: () -> console int 8 | finally/initially1/foo: () -> console int 9 | finally/initially1/main: () -> console () -------------------------------------------------------------------------------- /test/jsgen/config.json: -------------------------------------------------------------------------------- 1 | "--target=js -e" 2 | -------------------------------------------------------------------------------- /test/jsgen/err.kk: -------------------------------------------------------------------------------- 1 | import std/os/env 2 | import std/os/file 3 | import std/os/path 4 | 5 | fun main() 6 | val args = get-args() 7 | val file-path = match args 8 | Cons(file-path, Nil) -> file-path 9 | _ -> throw("Usage: program ", ExnError) 10 | val file-contents = read-text-file(file-path.path) 11 | () -------------------------------------------------------------------------------- /test/jsgen/err.kk.out: -------------------------------------------------------------------------------- 1 | uncaught exception: Usage: program -------------------------------------------------------------------------------- /test/jsgen/exn.kk: -------------------------------------------------------------------------------- 1 | // Issue: https://github.com/koka-lang/koka/issues/625 (make sure default exception handler is inserted) 2 | fun main() 3 | throw("Error") -------------------------------------------------------------------------------- /test/jsgen/exn.kk.out: -------------------------------------------------------------------------------- 1 | uncaught exception: Error -------------------------------------------------------------------------------- /test/jsgen/parse-int.kk: -------------------------------------------------------------------------------- 1 | // Issue: https://github.com/koka-lang/koka/issues/640 2 | 3 | fun main() 4 | val i = parse-int("123\n") 5 | println(i) 6 | () -------------------------------------------------------------------------------- /test/jsgen/parse-int.kk.out: -------------------------------------------------------------------------------- 1 | Nothing -------------------------------------------------------------------------------- /test/jsgen/vector-assign.kk: -------------------------------------------------------------------------------- 1 | fun main() 2 | var a := [0].vector 3 | a[0] := 1 4 | println(a[0]) -------------------------------------------------------------------------------- /test/jsgen/vector-assign.kk.out: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /test/kind/alias1.kk: -------------------------------------------------------------------------------- 1 | type total :: X 2 | alias id = forall a -> a 3 | alias choose = (id,id) -> id 4 | -------------------------------------------------------------------------------- /test/kind/alias1.kk.out: -------------------------------------------------------------------------------- 1 | choose : V 2 | id : V 3 | total : X 4 | 5 | pub alias choose = (id, id) -> id = 2 6 | pub alias id = forall (a) -> a = 1 -------------------------------------------------------------------------------- /test/kind/alias2.kk: -------------------------------------------------------------------------------- 1 | type int 2 | type list { con Single( field1 : a) } 3 | alias tt = list 4 | alias uu = list>> 5 | -------------------------------------------------------------------------------- /test/kind/alias2.kk.out: -------------------------------------------------------------------------------- 1 | int : V 2 | list : V -> V 3 | tt : V -> V 4 | uu : V 5 | 6 | pub alias tt :: V -> V = list = 1 7 | pub alias uu = list>> = 2 -------------------------------------------------------------------------------- /test/kind/alias3.kk: -------------------------------------------------------------------------------- 1 | // partially applied type synonym 2 | type foo 3 | 4 | alias id = a 5 | alias ap = f 6 | 7 | alias ok = ap -------------------------------------------------------------------------------- /test/kind/alias3.kk.out: -------------------------------------------------------------------------------- 1 | ap : (V -> V, V) -> V 2 | foo : V 3 | id : V -> V 4 | ok : V 5 | 6 | pub alias ap :: (V -> V, V) -> V = a = 1 7 | pub alias id :: V -> V = a = 1 8 | pub alias ok = ap = 2 -------------------------------------------------------------------------------- /test/kind/alias4.kk: -------------------------------------------------------------------------------- 1 | // test name hiding 2 | import static/modA 3 | 4 | alias aint = modA/aint 5 | alias ok1 = aint 6 | alias ok2 = modA/aint 7 | -------------------------------------------------------------------------------- /test/kind/alias4.kk.out: -------------------------------------------------------------------------------- 1 | aint : V 2 | ok1 : V 3 | ok2 : V 4 | 5 | pub alias aint = static/modA/aint = 2 6 | pub alias ok1 = aint = 3 7 | pub alias ok2 = static/modA/aint = 2 -------------------------------------------------------------------------------- /test/kind/bgroup1.kk: -------------------------------------------------------------------------------- 1 | type int 2 | type tt1 { con TT1(x: tt2) } 3 | type tt2 { con TT2(y: tt1) } 4 | -------------------------------------------------------------------------------- /test/kind/bgroup1.kk.out: -------------------------------------------------------------------------------- 1 | int : V 2 | tt1 : (V, V) -> V 3 | tt2 : (V, V) -> V -------------------------------------------------------------------------------- /test/kind/bgroup2.kk: -------------------------------------------------------------------------------- 1 | type int 2 | alias age = int 3 | type tt { con T(age : age) } 4 | alias uu1 = tt 5 | alias uu2 = tt 6 | -------------------------------------------------------------------------------- /test/kind/bgroup2.kk.out: -------------------------------------------------------------------------------- 1 | age : V 2 | int : V 3 | tt : V -> V 4 | uu1 : V -> V 5 | uu2 : (V, V) -> V 6 | 7 | pub alias age = int = 1 8 | pub alias uu1 :: V -> V = tt = 2 9 | pub alias uu2 :: (V, V) -> V = tt = 1 -------------------------------------------------------------------------------- /test/kind/bgroup3.kk: -------------------------------------------------------------------------------- 1 | type int 2 | alias aa = int 3 | alias bb = cc 4 | alias cc = aa 5 | type xx { con X( cc : cc ) } 6 | -------------------------------------------------------------------------------- /test/kind/bgroup3.kk.out: -------------------------------------------------------------------------------- 1 | aa : V 2 | bb : V 3 | cc : V 4 | int : V 5 | xx : V 6 | 7 | pub alias aa = int = 1 8 | pub alias bb = cc = 3 9 | pub alias cc = aa = 2 -------------------------------------------------------------------------------- /test/kind/config.json: -------------------------------------------------------------------------------- 1 | "-c -l --showkindsigs" -------------------------------------------------------------------------------- /test/kind/fix1.kk: -------------------------------------------------------------------------------- 1 | type fix { 2 | con Inn( fix: f> ) 3 | } 4 | -------------------------------------------------------------------------------- /test/kind/fix1.kk.out: -------------------------------------------------------------------------------- 1 | fix : (V -> V) -> V -------------------------------------------------------------------------------- /test/kind/fix1a.kk: -------------------------------------------------------------------------------- 1 | type fix V > { 2 | con Inn( out : f> ) 3 | } 4 | -------------------------------------------------------------------------------- /test/kind/fix1a.kk.out: -------------------------------------------------------------------------------- 1 | fix : (V -> V) -> V -------------------------------------------------------------------------------- /test/kind/fix2.kk: -------------------------------------------------------------------------------- 1 | div type recurse { 2 | con In( out : recurse -> a ) 3 | } 4 | -------------------------------------------------------------------------------- /test/kind/fix2.kk.out: -------------------------------------------------------------------------------- 1 | recurse : V -> V -------------------------------------------------------------------------------- /test/kind/type1.kk: -------------------------------------------------------------------------------- 1 | type void { } 2 | type unit { 3 | con Unit 4 | } -------------------------------------------------------------------------------- /test/kind/type1.kk.out: -------------------------------------------------------------------------------- 1 | unit : V 2 | void : V -------------------------------------------------------------------------------- /test/kind/type10.kk: -------------------------------------------------------------------------------- 1 | // Test if type synonym variables are correctly generalized in constructors. 2 | alias id = a 3 | alias ap = f 4 | type list { con Single(:a) } 5 | type yy { con Yy( :ap ) } 6 | type zz { con Zz( :ap> ) } 7 | -------------------------------------------------------------------------------- /test/kind/type10.kk.out: -------------------------------------------------------------------------------- 1 | ap : (V -> V, V) -> V 2 | id : V -> V 3 | list : V -> V 4 | yy : V -> V 5 | zz : V -> V 6 | 7 | pub alias ap :: (V -> V, V) -> V = a = 1 8 | // Test if type synonym variables are correctly generalized in constructors@ 9 | pub alias id :: V -> V = a = 1 -------------------------------------------------------------------------------- /test/kind/type2.kk: -------------------------------------------------------------------------------- 1 | type bool { 2 | False 3 | True 4 | } 5 | -------------------------------------------------------------------------------- /test/kind/type2.kk.out: -------------------------------------------------------------------------------- 1 | bool : V -------------------------------------------------------------------------------- /test/kind/type3.kk: -------------------------------------------------------------------------------- 1 | type maybe { 2 | con Nothing 3 | con Just( :a ) 4 | } 5 | -------------------------------------------------------------------------------- /test/kind/type3.kk.out: -------------------------------------------------------------------------------- 1 | maybe : V -> V -------------------------------------------------------------------------------- /test/kind/type4.kk: -------------------------------------------------------------------------------- 1 | type list { 2 | con Nil 3 | con Cons( head : a, tail : list ) 4 | } 5 | -------------------------------------------------------------------------------- /test/kind/type4.kk.out: -------------------------------------------------------------------------------- 1 | list : V -> V -------------------------------------------------------------------------------- /test/kind/type5.kk: -------------------------------------------------------------------------------- 1 | type int 2 | type app { con App( app: f