Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
My Modules
defmodule MyODT do
@opaque t() :: %{required(:f1) => boolean, required(:f2) => atom}
@spec new(boolean, atom) :: t
def new(f1, f2), do: %{f1: f1, f2: f2}
@spec f1(t) :: boolean
def f1(%{f1: f1}), do: f1
def f2(%{f2: f2}), do: f2
defmodule MyODTUser do
@spec new_odt(boolean, atom) :: MyODT.t
def new_odt(f1, f2), do:, f2)
@spec print_odt(MyODT.t) :: :ok
def print_odt(odt), do: :io.format("~p: ~p~n", [MyODT.f2(odt), MyODT.f1(odt)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.