Show newer
Gavin Zhao boosted

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):

1. calling sync js function

foreign import javascript unsafe "console.log($1)" js_log :: JSVal -> IO ()

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.

2. calling async js function

foreign import javascript "fetch($1)" js_fetch :: JSString -> IO JSVal

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.

3. js callback -> haskell function

foreign import javascript "dynamic" js2hs :: JSVal -> Arg1 -> Arg2 -> Result

pretty much same thing like "dynamic" ccalls, though we use JSVal to represent a js callback instead of FunPtr.

4. hs function -> js callback

foreign import javascript "wrapper" hs2hs :: (Arg1 -> Arg2 -> Result) -> IO JSVal

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.

5. foreign exports

foreign export javascript "js_func_name" hs_func_name :: Arg1 -> Arg2 -> Result

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

Gavin Zhao boosted

RT GyDi
Git可以这样根据不同的目录去区分git配置,这样就可以对不同的项目设置不同的全局user email了

:sys_twitter: twitter.com/zzzgydi/status/171

Gavin Zhao boosted

⠀⠀⠀⠀⠰⢷⢿⠄
⠀⠀⠀⠀⠀⣼⣷⣄
⠀⠀⣤⣿⣇⣿⣿⣧⣿⡄
⢴⠾⠋⠀⠀⠻⣿⣷⣿⣿⡀
🏀 ⠀⢀⣿⣿⡿⢿⠈⣿
⠀⠀⠀⢠⣿⡿⠁⠀⡊⠀⠙
⠀⠀⠀⢿⣿⠀⠀⠹⣿
⠀⠀⠀⠀⠹⣷⡀⠀⣿⡄
⠀⠀⠀⠀⣀⣼⣿⠀⢈⣧

Gavin Zhao boosted
Gavin Zhao boosted

I'm excited to announce a new "prefaculty" position working with the type systems team at Jane Street on the OCaml compiler!

I think this should be an exciting position for someone who is starting off their academic career and is looking to learn more about large scale practical applications of type systems, and to build longer term research connections.

Please retoot!

janestreet.com/join-jane-stree

Gavin Zhao boosted

Unfortunately due to an upcoming #furlough, I will need to look for other work (full-time or otherwise). If you or someone you know need a senior #frontend / full-stack dev, in #EU (I live in Finland, remote work), please boost, ping, slide into DMs or email me (in CV).

I put together an image with some tech. info and what I do in my free time, CV posted below with link as well. Requirements and preferences in 🧵

joshuastrobl.com/CV.pdf

Boosts greatly appreciated ❤️

#mastodonjobs #jobsearch

Gavin Zhao boosted

Coming to Mastodon from Twitter feels like busting in the door loudly brandishing a half drunk bottle of tequila and finding everyone sitting in horrified silence holding cups of tea and academic papers

我对Bazel真是又爱又恨。不出问题的时候就感觉是世界上最好的构建系统,甩了CMake和Meson好几条街;开始报错修bug的时候就恨不得一行sudo rm -rf /下去毁灭世界

Gavin Zhao boosted

@mashiro 70%宣传过头了,没有那么夸张。翻了一下原论文,里面说对于短(shorter sequences)的数组的排序的速度提升70%,但对于长度超过25万的数组的速度提升只有1.7%。而且这个优化没有太复杂,说简单点就是在Assembly里面找到了一个多余的%mov指令,在我看来并不算开发了一个新的算法。

Gavin Zhao boosted

I really want to see Arthur Whitney do competitive programming. Imagine a link-cut tree in three lines of C...

@phoronix I understand what their point is, but perhaps the language could've been phrased better. Maybe the author wrote it after they got annoyed by a few users kept asking them to fix X.org-related bugs. I've experienced similar situations and they are indeed often frustrating.

@mashiro 你给我住手啊啊啊啊啊啊ヽ(#`Д´)ノ

Gavin Zhao boosted

It is time for #Solus to embark on a new voyage. The journey ahead is incredibly exciting for users and contributors alike - the very foundations of our project, the ideas that held us together over the years, are finally coming to fruition.

Read more at getsol.us/2023/04/18/a-new-voy

Gavin Zhao boosted

Hey folks, Josh here. Long time no see.

We got a new post up on Reddit and will have a blog post forthcoming on Tuesday, with organizational structure changes, plans for #Solus 4.x, Solus 5, and more.

reddit.com/r/SolusProject/comm

Show older
小森林

每个人都有属于自己的一片森林,也许我们从来不曾走过,但它一直在那里,总会在那里。迷失的人迷失了,相逢的人会再相逢。愿这里,成为属于你的小森林。