Skip to content

Instantly share code, notes, and snippets.

@lpil
Last active May 28, 2020 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lpil/6c9eaed034f7da92d61a10b09cb6adf5 to your computer and use it in GitHub Desktop.
Save lpil/6c9eaed034f7da92d61a10b09cb6adf5 to your computer and use it in GitHub Desktop.
Custom type helper for Erlang/Elixir.
-module(thing).
-export([makePerson/1]).
makePerson(#{name => Name, gender => Gender, age = Age}) ->
{person, Name, Gender, Age}.
personToMap({person, Name, Gender, Age}) ->
#{name => Name, gender => Gender, age => Age}.
pub type Person {
Person(name: String, gender: Option(String), age: Int)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment