Use @type
to define custom types. For example, we can imagine definining types in an API client:
@type body :: any
@type status_code :: integer
@type request_method :: :get | :put | :post | :delete | :put | :patch | :head
@type header :: { binary, binary }
@type response :: { status_code, any, [header] }
@type payload :: %Payload{ method: request_method, id: binary, size: integer }
You can use custom types in the definition of types, such as how the above
header
type is used inresponse
.
Additional reading: