Skip to content

Instantly share code, notes, and snippets.

@koolquark
Created June 21, 2019 11:06
Show Gist options
  • Save koolquark/f566c75de71c2d986afa8df720451e6a to your computer and use it in GitHub Desktop.
Save koolquark/f566c75de71c2d986afa8df720451e6a to your computer and use it in GitHub Desktop.
Elixir - Map matching at function head
defmodule MapTest do
def hmap(%{ :a => "a"} = changeset) do
IO.inspect changeset
end
end
MapTest.hmap(%{ :a => "a", :b => "B" }) # matches
MapTest.hmap(%{ :a => "A", :b => "B" }) # clause error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment