ex_type icon indicating copy to clipboard operation
ex_type copied to clipboard

Maybe support inline type hint

Open gyson opened this issue 6 years ago • 0 comments

We should already be able to do type hint with T.assert( expr :: type ). For example,

map = %{} 

# type is empty map

T.assert(map :: %{optional(String.t) => integer})

# type is updated to %{optional(String.t) => integer} now.

if we support inline type hint like expr ~> type annotation. it may be easier (syntax sugar) to do type declaration, especially in pattern match.

we can do

{first ~> integer(), second ~> String.t} = something_untyped

instead of

{first, second} = something_untyped
T.assert first :: integer
T.assert second :: String.t

^^ benefit is to avoid write first and second twice.

Implementation concern

need to do some hacky thing to make it work. not sure if it worths the cost.

gyson avatar Apr 27 '19 03:04 gyson