ityonemo / mavis

opinionated typing library for elixir
MIT License
110 stars 4 forks source link

open questions about Erlang Types #15

Open ityonemo opened 4 years ago

ityonemo commented 4 years ago

this issue will remain open for open questions about erlang types

ityonemo commented 4 years ago
  1. Should none be a subtype of all types? "In theory" the answer should be yes. However, what is the correct answer might depend on how agressively none is used to represent crashes? no_return is the type of something which only tail calls into itself (or raises) and is equivalent to none. Should integer | no_return resolve to integer or stay as integer | no_return?

currently, it's set to not be a subtype of anything (including any)

ityonemo commented 4 years ago
  1. How should function parameters be treated? Currently, two type inputs into functions must be EQUAL to be merged. For example:

(5 -> integer) | (4 -> integer) --> (4..5 -> integer) (5 -> atom) | (integer -> integer) --> (integer -> atom | integer)

ityonemo commented 4 years ago
  1. https://github.com/ityonemo/mavis/issues/1

current strategy is to ignore all required() fields that aren't singleton types.

ityonemo commented 4 years ago
  1. https://github.com/ityonemo/mavis/issues/29
ityonemo commented 4 years ago

what happens when you have a map definiton where two type definitions overlap, for example:

%{optional(:pos_integer) => :atom, optional(1..100) => :fizz | :buzz | :fizzbuzz}

what happens if they are disjoint?

%{optional(:pos_integer) => :atom, optional(1..100) => :fizz | :buzz | :fizzbuzz | integer}

what happens if one is required?

%{required(:foo) => :bar, optional(atom) => atom}