ok. sparks is indeed a nice way to get work stealing nested parallelism for free in #haskell, as long as you work with spark# directly and don't use par, pseq or anything built upon these combinators
til nix builds started as root does not go to nix-daemon...which means i also need to lower the nixos-upgrade.service nice level on my vps to prevent the builds from impacting the responsiveness. hmm
削足就履,aka "cutting foot to fit in the shoe", aka "fitting your green thread system into wasm as shipped in browsers today, no asyncify cheat no worker thread cheat, oh btw your implementation must support async exceptions to the extent that a message passing agent system can live on top of it, literally"
it's funny to ask chatgpt a question and watch it spit out a latex formula, "analyzing" for a while, and "oops why it output 100% probability, doesn't make sense, let's try another formula" (it's 0 according to common sense), repeat a few times and then give up
postgres, redis, elasticsearch, need to go over these quests before the final quest: mastodon. oh and i didn't even mention smtp or any self hosted email stuff. not worth spending any time on that front!
poor man's cmm debugger is compiling via c and passing "stage1..ghc..opts += -keep-tmp-files -optc-g3" to hadrian (-optc-g3 is required even with debug_info flavour transformer). this way you don't need to scratch your hair against a bunch of x64 assembly when debugging cmm segfault with gdb
i've just finished 3 body problem (netflix adaption) and as someone who read the original novel series in chinese, i enjoy most parts of the show. a few scenes that i like or dislike (spoiler alert)
if people want "apt install" experience with nix, instead of trying to force feed "declarative" or "reproducible" down their throat, how about giving them an actual cli that they can do "nix install" in the same nix shell and have the changes reflected in the nix file. and nope, you know i'm not talking about "nix profile install"
ah, so with memfd_create+mmap you can have multiple virtual address ranges alias to the same physical memory range, and it's useful for gc implementation (azul's c4 paper mentions its usage)
join the petition to tax higher order functions from programming! don't let devs get away without paying maintenance tax when they casually add a continuation parameter and pass a function defined 100k lines away in the codebase
ghc wasm backend jsffi has finally been implemented! the rest is source notes as well as user-facing documentation. not sending a #haskell discourse thread yet, but for the curious eyes, here's what's supported so far (and also an ama thread):
js src text can be any valid js expr or statements, using $1 etc to refer to the haskell arguments. JSVals are first class haskell values and garbage collected.
await is supported in js src text. calling it initiates the side effect immediately, and returns a thunk that only blocks on promise resolution when forced, allowing concurrency without even needing to fork haskell threads. promise rejections are captured as haskell exceptions.
yup, this converts any haskell function closure to a js callback that you can pass to 3rd party frameworks. it's garbage collected on the js side as well, the haskell closure will be dropped if the callback is unreachable in js later.
this will end up as a wasm export named "js_func_name" directly callable in js, and it returns a promise of the final result that can be awaited.
the hardest part of all the above work is concurrency & re-entrancy: calling async js should be cheap, should not block the runtime, should play well with existing threading model in haskell. and hs can call into js that calls back into hs, indefinitely. i'll write up more detailed explanation on how this is delivered
have been discussing game engine and server and ecs stuff with homie after our self hosted palserver crashed for a second time in a day. and then he showed me a siggraph23 paper that implements an ecs in a gpu for a game backend...with a repo i starred long ago but never bothered to take a closer look
ah another #nixos 23.11 footgun: i lost my previous systemd lingering and i was scratching my head why my services kept exiting...the good news is, "users.users.<name>.linger" is now a thing