Punning

With this library you get language support for field punning in maps within Elixir.

The syntax is very simple, when you write

%{field}

this will be transformed into:

%{field: field}

For now it only works in function heads and bodies. You can enable punning by just use-ing this package:

defmodule App
  use Punning

  def fun(%{field}), do: field
end

Installation

The package can be installed by adding punning to your list of dependencies in mix.exs:

def deps do
  [
    {:punning, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/punning.