Today I Learned: Aliasing an Elixir Module Within Itself

Wednesday August 1, 2018 at 09:21 pm CST

originally published 1/26/2018 on the Hashrocket TIL blog

I was attempting to compile a Phoenix application and I got this error:

The issue was in a function I defined in the module.

I assumed that you would get references to a module within said module for free. That’s not the case. There are two ways to fix the error. One is to use the full module name in the parameter list.

Alternatively, I can alias the module within itself.


Photo by Jonny Caspari on Unsplash