Croma.SubtypeOfTuple (croma v0.11.1) View Source

Helper module to define tuple-based types. The following members are generated by use Croma.SubtypeOfTuple:

  • @type t
  • @spec valid?(term) :: boolean
  • If any of :elem_modules exports new/1,
    • @spec new(term) :: Croma.Result.t(t)
    • @spec new!(term) :: t

Options:

  • :elem_modules - A list of type modules for tuple elements.
  • :default - Default value for this type. Passing this option generates default/0.

Examples

defmodule MyTuple do
  use Croma.SubtypeOfTuple, elem_modules: [MyInt, MyString]
end