Elixir Wizards S4E10 Lau Taarnskov on the Trouble with Time Zones Using Telemetry Effectively

Tyyppi → bringing erlang typespecs to runtime

Welcome Tyyppi library that allows dealing with types in runtime, including but not limited to:

  • runtime check if this term is of that type with Tyyppi.of?/2, e. g. Tyyppi.of?(GenServer.on_start(), :ok) (it’s apparently not :))
  • apply the function providing its spec so that it returns {:ok, result} if and only if all the arguments and the result meet the specs, and {:error, {:arity | :args | :result, value}} otherwise
  • create a typed struct with generated complete detailed t() :: %…{…} type definition, type checks on upserts, and a possibility to cast values on upserts to the expected type (TBD).