Skip to content

Instantly share code, notes, and snippets.

View GoNZooo's full-sized avatar

Rickard Andersson GoNZooo

View GitHub Profile
startLink :: Arguments -> Effect (StartLinkResult (Process Message))
startLink arguments = do
SimpleServer.startLink arguments { init, handleInfo, name: Nothing }
init :: Arguments -> ProcessM Message (InitValue State)
init { socket } = do
self' <- Process.self
liftEffect $ Process.send self' ReadRequest
pure $ SimpleServer.initOk { socket, prices: MapSet.empty }
@GoNZooo
GoNZooo / language_integration.lua
Last active April 23, 2023 09:14
A basic setup for being able to interact with your `iex` sessions live via RPC calls
local M = {}
local erl_call = "erl -noshell -sname neovim -eval"
M.beam_dev_helper_rpc = function(node, module, function_name)
return "rpc:call(" .. node .. ", " .. module .. ", " .. function_name .. ", []), halt(0)."
end
M.execute_erlang_rpc_call = function(node, module, function_name)
local command = erl_call .. " \"" .. M.beam_dev_helper_rpc(node, module, function_name) .. "\""
Nothing :: struct {}
Just :: struct($T: typeid) {
value: T,
}
Maybe :: union($T: typeid) {
Nothing,
Just(T),
}