Skip to content

Instantly share code, notes, and snippets.

@robotarmy
Last active November 29, 2016 01:56
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 robotarmy/ad6d13fcf76f97ab35a82262667896b9 to your computer and use it in GitHub Desktop.
Save robotarmy/ad6d13fcf76f97ab35a82262667896b9 to your computer and use it in GitHub Desktop.
defmodule TypeiTest do
use ExUnit.Case
doctest Typei
# declare type that is made up of other types
@type payment :: %Payment{ # Payment is a ...? Record?? Struct??)
invalid_at :: DateTime.t, # DateTime specifically tied to ... ? Module??
admin_removed_at :: DateTime.t,
removed_at :: DateTime.t,
ready_at :: DateTime.t,
payout_at :: DateTime.t,
created_at :: DateTime.t,
id :: number # float or int (vague)
}
test "the truth" do
payment = %Payment{} # need to make empty by using ... ? %Payment{}??
payment.last_event = "ready"
assert payment.last_event = "ready"
end
end
@robotarmy
Copy link
Author

robotarmy commented Nov 29, 2016

What is the correct syntax for declaring a type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment