By-module operators

So, importing a module with many predicates, many of which I need.

But darn it, it also exports an operator, and I need the operator.
so I have to list explicitly all the predicates, just so I can include the operator.

Is there a workaround?

? You either use use_module/1 and get all predicates and operators. That is what I usually do, unless conflicts arise or are likely. Or, you use use_module/2 and define the predicates and operators you want. You can import a predicate without its operator or the other way around. They are completely unrelated. Importing operators allows for patterns, typically op(_,_,<name>) or op(_,_,_) to get either a specific operator, but regardless of its priority and association or all operators from the module.

1 Like

Oh, wait, the docs say use_module/1 does NOT give you the operators.
Hence my gunging (and confusion).

I chased to load_file import option to get the syntax.

If Import equals all , all operators are imported as well. Otherwise, operators are not imported. Operators can be imported selectively by adding terms op(Pri,Assoc,Name) to the Import list. If such a term is encountered, all exported operators that unify with this term are imported. Typically, this construct will be used with all arguments unbound to import all operators or with only Name bound to import a particular operator.

wasn’t obvious that use_module/1 was ‘all’
8cD