Skip to content

Instantly share code, notes, and snippets.

@Nymphium
Last active December 7, 2021 07:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nymphium/3cb574cb511a179a30390599e6e51669 to your computer and use it in GitHub Desktop.
Save Nymphium/3cb574cb511a179a30390599e6e51669 to your computer and use it in GitHub Desktop.
typed prompt-less shift/reset in Koka language
module typed-delimcc
public effect subcont0<a> {
fun shift0(f : (b -> a) -> a) : b
}
public fun reset0(th : () -> subcont0<a> a) : a {
handle(th) {
shift0(f) -> f(resume)
}
}
public effect subcont<a> {
fun shift(f : (b -> div a) -> a) : b
}
public fun reset(th: () -> <subcont<a>, div> a) : div a {
handle(th) {
shift(f) -> unsafe-nodiv{reset{unsafe-nodiv{f(resume)}}}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment