Hello Hello,
I have a bunch of function clauses (means one function, but different clauses to match for different input parameters). This function is basically an API handler.
def handle_event_type(event_type = "car_started", _params) do
# do sth.
end
def handle_event_type(event_type = "car_stopped", _params) do
# do sth. else
end
I wanna structure and organise a little bit for better readability according to the different business use cases. So my idea was to put the different function clauses in one file per use case and import those files back into my central API handler file to consolidate everything again.
But I get the following error:
== Compilation error in file lib/project/controllers/api_controller.ex ==
** (CompileError) lib/project/controllers/api_controller.ex:90: imported Project.ApiHandler.handle_event_type/2 conflicts with local function
(elixir 1.11.4) src/elixir_locals.erl:94: :elixir_locals.“-ensure_no_import_conflict/3-lc$^0/1-0-”/2
(elixir 1.11.4) src/elixir_locals.erl:95: anonymous fn/3 in :elixir_locals.ensure_no_import_conflict/3
(stdlib 3.14.1) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir 1.11.4) lib/kernel/parallel_compiler.ex:314: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7
Any other idea to organise everything better?