I wanna to try to start Agent in Supervisor with one line for test purpose:
iex(1)> {:ok, pid} = Supervisor.start_link([{Agent, [fn -> 42 end, name: :test]}], strategy: :one_for_one)
** (EXIT from #PID<0.115.0>) evaluator process exited with reason: shutdown: failed to start child: Agent
** (EXIT) an exception was raised:
** (FunctionClauseError) no function clause matching in Agent.start_link/2
(elixir) lib/agent.ex:215: Agent.start_link([#Function<20.99386804/0 in :erl_eval.expr/5>, {:name, :test}], [])
(stdlib) supervisor.erl:365: :supervisor.do_start_child/2
(stdlib) supervisor.erl:348: :supervisor.start_children/3
(stdlib) supervisor.erl:314: :supervisor.init_children/2
(stdlib) gen_server.erl:365: :gen_server.init_it/2
(stdlib) gen_server.erl:333: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Please notice Supervisor.start_link([{Agent, [fn -> 42 end, name: :test]}], strategy: :one_for_one), This code throw error to me, Is it problems with syntax?
I am using Elixir 1.5
start_linkfunction defined with 2 arguments. What's in yourAgentmodule? - Máté