defmodule IsWhat do @moduledoc """ Documentation for `IsWhat`. """ @doc """ type?/1 Defines the type of the given data. ## Examples iex> IsWhat.type?(true) "true is boolean." """ @spec type?(any()) :: String.t() def type?(nil), do: "data is nil." def type?(data) when is_binary(data), do: "#{data} is binary." def type?(data) when is_boolean(data), do: "#{data} is boolean." def type?(data) when is_atom(data), do: "#{data} is atom." def type?(data) when is_tuple(data), do: "#{inspect(data)} is tuple." def type?(data) when is_list(data), do: "#{inspect(data)} is list." def type?(data) when is_map(data), do: "#{inspect(data)} is map." def type?(data) when is_integer(data), do: "#{data} is integer." def type?(data) when is_number(data), do: "#{data} is number." def type?(data) when is_struct(data), do: "#{data} is struct." @doc """ sample_function/1 Returns tuple ## Examples iex> IsWhat.sample_function(true) {:ok, "Successfully."} """ @spec sample_function(boolean()) :: {:ok, String.t()} | {:error, String.t()} def sample_function(_data), do: {:ok, "Successfully."} end