witchcrafters/type_class

use TypeClass is superfluous

michalmuskala opened this issue · 1 comments

TypeClass.__using__/1 is defined as:

  defmacro __using__(_) do
    quote do
      require unquote(__MODULE__)
      import  unquote(__MODULE__)
    end
  end

When a module is imported, the imported macros can be invoked without require, so the require is not necessary. This leaves import as the sole member of __using__, which is considered a bad practice. It's much clearer to the user of the library to say what is happening when they see:

import TypeClass

than, when they see:

use TypeClass

That could be doing anything.

Indeed! Thanks for pointing that out 😄 Updated