Skip to content

Instantly share code, notes, and snippets.

@wende
Created March 1, 2016 18:48
Show Gist options
  • Save wende/49d2aa3f466ad60cc3fe to your computer and use it in GitHub Desktop.
Save wende/49d2aa3f466ad60cc3fe to your computer and use it in GitHub Desktop.
defmodule SomeProtocol do
@on_load :start_agent
def start_actor() do
{result, pid} = Agent.start_link(fn -> 0 end)
result
end
def __using__() do
quote do
@on_load :add_me
def add_me() do
Agent.update fn modules -> [__MODULE__ | modules] end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment