mrluc/mex
{ "createdAt": "2015-09-25T04:45:41Z", "defaultBranch": "master", "description": "Readable, side-by-side macro-expansion display for Elixir's interactive shell.", "fullName": "mrluc/mex", "homepage": "", "language": "Elixir", "name": "mex", "pushedAt": "2016-02-02T18:44:43Z", "stargazersCount": 157, "topics": [], "updatedAt": "2025-10-08T01:47:58Z", "url": "https://github.com/mrluc/mex"}An Elixir Shell helper for previewing macroexpansion.
Displays different levels of macroexpansion side-by-side, along with where and why the expansion fails (if it does).
![Samples of output and error display]!(doc/output_samples.png)
Installation
Section titled “Installation”Install by adding a dev dependency on mex:
-
Add mex to your list of dependencies in
mix.exs:def deps do [{:mex, ”~> 0.0.1”, only: :dev}] end
-
Ensure mex is started before your application:
def application do [applications: [:mex]] end
Then import and configure it in your project’s .iex.exs:
import MexMex.set_width 160 # (optional) default width is 80 charsmex do expr # <-- expression you'd like expanded.endBy default, mex will display 4 columns: no_expansion,
Macro.expand_once, Macro.expand, and Mex.expand_all.
You can display fewer columns (1-3) by passing
an argument to mex before the block:
iex(0)> import Mexiex(2)> mex 3 do expression_to_macro_expand end
<will display 3 columns>You can also display only a single expander by instead
supplying one of :none, :once, :expand, :all as argument,
or use the function Mex.pp_compare if you want to supply
your own expanders.