Current section
Files
Jump to
Current section
Files
lib/type_of.ex
defmodule SylonUtils.TypeOf do
def type_of(term) when is_nil(term), do: "Type: Nil"
def type_of(term) when is_binary(term), do: "Type: Binary"
def type_of(term) when is_boolean(term), do: "Type: Boolean"
def type_of(term) when is_atom(term), do: "Type: Atom"
def type_of(term) when is_integer(term), do: "Type: Integer"
def type_of(term) when is_float(term), do: "Type: Float"
def type_of(term) when is_number(term), do: "Type: Number"
def type_of(term) when is_function(term), do: "Type: Function"
def type_of(term) when is_list(term), do: "Type: List"
def type_of(term) when is_tuple(term), do: "Type: Tuple"
def type_of(%_{} = term) when is_map(term), do: "Type: Struct"
def type_of(term) when is_map(term), do: "Type: Map"
def type_of(_term), do: "Type: Unknown"
end