Пример
defmodule Stack do
use GenServer
def start_link(state), do: GenServer.start_link(__MODULE__, state, name: Stack)
def init(state), do: {:ok, state}
def handle_cast({:push, item}, _from, state), do: {:noreply, [item | state]}
def handle_call(:pop, _from, [top | rest]), do: {:reply, top, rest}
end