Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Isaac Clayton
    @slightknack:envs.net
    [m]
    nw — just message me when you're free
    Isaac Clayton
    @slightknack:envs.net
    [m]
    :point_up: Edit: nw — just message me when you're free @alexreinking
    karroffel
    @karroffel:matrix.poto.cafe
    [m]
    Hey! Just saw the new release, what things are new in 2.1(.1)?
    Dario Oddenino
    @dariooddenino
    Just discovered koka and dropped by to say hi and congrats! :)
    Joel McCracken
    @JoelMcCracken_gitlab
    hi!
    I tried using the JS backend and ran into some trouble pretty early on; is there a known-good version of that which works well?
    if it would be helpful, i could look into adding some regression tests for the JS backend
    Roman
    @kpp
    Hi! Is there a way to handle the core effects: console, fsys, net, heap?
    McCoy R. Becker
    @femtomc
    Is Koka still being actively developed?
    Alex Reinking
    @alexreinking
    Yes
    Anonymous
    @oxapp
    Yes, definitely -- I am regularly in contact with Daan Leijen who is publishing new versions of Koka 2 all the time. The performance of the language has improved by orders of magnitude over the last two years (maybe 10x faster).
    I'd wager that out of all of the languages that allow for programming with effects, it is becoming the strongest actually. Feel free to debate me on this and change my mind...
    Alex Reinking
    @alexreinking
    I don't think that's debatable, though :)
    Daan
    @daanx
    :-) very much alive -- currently almost all focus is on the native (C) backend and improving practicality (libraries!) and ease of use. (@JoelMcCracken_gitlab : the JS backend needs indeed some love -- just few tweaks are required though to bring it up to date; I will look into it soon as it is good to have around. )
    McCoy R. Becker
    @femtomc
    Cool -- just for reference: I'm from the Julia world, where I work on probabilistic programming. I'm exploring new language ideas, so I was just curious.
    Joel McCracken
    @JoelMcCracken_gitlab
    i was thikning about attempting to build a little webapp with koka
    (fwiw)
    Asger Alstrup Palm
    @alstrup

    Hi, I'm trying to make a global reference to a vector.

    val securityModes = ref(vector([]));

    but get an error that generalized values can not have effects. What to do?

    Asger Alstrup Palm
    @alstrup
    Another question: How do I compare two int32's?
    fun foldRange(start : int32, end : int32, acc : a, fn : (a, int32) -> a) : a {
    if (start<=end) {
    foldRange(start+1, end, fn(acc, start), fn)
    } else {
    acc
    }
    }
    Asger Alstrup Palm
    @alstrup
    and I get
    koka.kk(9,17): error: no function (<=) is defined that matches the argument types
    context : start<=end
    term : <=
    inferred type: (int32, _a, ...) -> ...
    candidates : (<=): (double, double) -> bool
    (<=): (int, int) -> bool
    (<=): (char, char) -> bool
    (<=): (x : string, y : string) -> bool
    (<=): (x : bool, y : bool) -> bool
    (<=): (x : order, y : order) -> bool
    Asger Alstrup Palm
    @alstrup
    OK, found out that I can do "import std/num/int32" to get the comparisons in scope. So the remaining question is the global ref.
    Caden Haustein
    @brightly-salty:matrix.org
    [m]
    Not familiar with Koka, just algebraic effects in general, and I think you can't do that because the toplevel of the program must be pure - there can't be effects that occur when computing a value's value.
    Asger Alstrup Palm
    @alstrup
    OK, so how do I have global mutable state?
    Do I have to thread that around in the entire program?
    Caden Haustein
    @brightly-salty:matrix.org
    [m]
    I would assume so, yeah. But at that point you might as well just make it immutable state and get the fp benefits
    Asger Alstrup Palm
    @alstrup
    Sure. In this case, I'm writing a backend to a ML-family language compiler that targets Koka.
    So I'm dealing with existing programs that assume there is such a thing as global state.
    Therefore, hope there is some way to do it, since otherwise, all functions will get an extra argument with the global state. That sounds bad for performane, and the entire point for having a Koka backend is that Koka seems to be a really, really fast functional language with the Perceus memory algorithm.
    I guess I can use the "inline js" syntax, which I noticed that the implementation uses, and thus just emit raw code that does it.
    maybe there is a cleaner way, though.
    Asger Alstrup Palm
    @alstrup
    Some kind of polymorphic global state, accessible with "setGlobal(id, value)", "getGlobal(id)" or something like that would work just fine. So come worst, those can probably be implemented with extern and js inline, c inline trickery.
    Caden Haustein
    @brightly-salty:matrix.org
    [m]
    Again, not familiar with Koka, but could you make securityModes a function that returns the Koka equivalent of a Haskell IORef [a] and then be able to get and set the IORef?
    Asger Alstrup Palm
    @alstrup
    Yeah, good idea.
    So we need some Koka expert to help understand how to make that happen.
    Asger Alstrup Palm
    @alstrup

    Syntax question: How do I make a "local" expression value binding:

    fun isPalindromic(s : string) : div bool {
    val l = strlen(s)
    l<=int32(1) || {
    val first = strLeft(s, int32(1))
    val last = strRight(s, l - int32(1))
    first==last&&isPalindromic(strsubsmart(s, int32(1), -int32(1)))
    }
    }

    This does not parse.

    fun isPalindromic(s : string) : div bool {
    val l = strlen(s)
    l<=int32(1) || (
    val first = strLeft(s, int32(1))
    val last = strRight(s, l - int32(1))
    first==last&&isPalindromic(strsubsmart(s, int32(1), -int32(1)))
    )
    }

    does not parse either

    Asger Alstrup Palm
    @alstrup
    I guess Koka is not an expression based language. It seems it has statements? A bit surprising, but OK.
    codysseus (they/them)
    @codysseus:matrix.org
    [m]
    Yeah it's not like haskell
    It's a function based language
    Asger Alstrup Palm
    @alstrup
    So is ML and that is expression based. I assumed Koka would be, but I was wrong. No big deal - lambdas are expressions so I can just wrap let-statements in local lambdas in my compiler that targets Koka.
    Louis Pilfold
    @lpil
    Hello everyone. Is there a way to view the C that a small Koka program compiles to? Thank you.
    Ah, koka -c --showc hello.koka! Thanks
    Zheyu Shen
    @arsdragonfly
    how do I get the first element of a tuple in koka?
    1 reply
    other than manually pattern matching
    artemonster
    @artemonster
    Hi, maybe someone can help: https://stackoverflow.com/questions/68550407/how-handler-control-stackframes-are-placed-relative-to-each-other-in-koka
    trying to understand all the stackframe craziness when throwing (effecting?) :)
    artemonster
    @artemonster
    I have tried adding a second resume and I have no idea how to de-entangle that :D
    thank you!
    Zhe Wang
    @wangzhe3224
    may I ask where is Koka going? system level dev like C/Rust or application dev like Java?