View Source Interval.Intervalable protocol (Interval v0.3.4)
iex> Interval.new(left: 1, right: 2)
iex> Interval.new(module: Interval.Integer, left: 1, right: 2) # or equivalent iex> Interval.Integer.new(left: 1, right: 2)
This functionality is purely for ergonomic reasons, and is not required to be able to define custom intervals, or to use the builtin ones.
Interval.Integer.new/1 could be preferred in certain
situations because you know exactly what implementation you are getting.