Last active
May 28, 2020 18:42
-
-
Save lpil/6c9eaed034f7da92d61a10b09cb6adf5 to your computer and use it in GitHub Desktop.
Custom type helper for Erlang/Elixir.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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