Typable v0.2.0 Type View Source
Utilities for Typable protocol
Link to this section Summary
Functions
Returns term which is instance of given type. Have compile-time guarantees
Link to this section Functions
Link to this macro
instance_of(quoted_type) View Source (macro)
Returns term which is instance of given type. Have compile-time guarantees.
Examples
iex> require Type
iex> Type.instance_of(Integer)
0
iex> Type.instance_of(Port)
#Port<0.0>
iex> Type.instance_of(URI)
%URI{}
iex> quote do
...> require Type
...> Type.instance_of(TypeNotExist)
...> end
...> |> Code.eval_quoted()
** (UndefinedFunctionError) function TypeNotExist.__struct__/0 is undefined (module TypeNotExist is not available)
Link to this function