All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added
Inspect
protocol implementation for all intervals created withuse Interval
(which includes all builtin types) so they now look like#Interval.Float<[1.0, 3.0)>
instead of%Interval.Float{left: {:inclusive, 1.0}, right: {:exclusive, 3.0}}
- Support for intervals of
NaiveDateTime
. - A Logo. For no good reason.
- Fixed typespec on
size/1
forInterval.DateTime
- Fixed dialyzer warnings.
- The optional dependencies was also specified as test and dev only, which is not what we want. We want them optional, but all environments.
- Issue #19. Could not compile when the dependant project did not have Ecto included, which was a bug.
- Added type and typespecs for builtin types.
- Added additional documentation in
Interval
- Mostly automatic support
Ecto.Type
(including for builtin interval types) left/1
andright/1
to extract the left and right values from the interval.- Builtin
Jason.Encoder
support. Interval.__using__
optionjason_encoder
for including encoder. Defaults totrue
.Interval.to_map/1
to convert an Interval struct to a map suitible for JSON and similar serialization.Interval.Decimal
forDecimal
support.
Interval.__using__
optiondiscrete
is now optional, and defaults tofalse
- Allow opting out of built in implementations by configuring
:interval, Interval.Float: false
- Adding
Interval.Intervalable
protocol, which allows you to define what interval implementation to use for value types. This is purely for ergonomic reasons. - Special-case for empty intervals, which doesn't require implementation-specific behaviour.
- Adding
Interval.contains_point?/2
- Adding
Interval.partition/2
- Adding
Interval.size/1
- Various
RuntimeError
s handling bad input to a function has been converted toArgumentError
s Point.previous(a)
andPoint.next(a)
becamepoint_step/2
in theInterval.Behaviour
.Interval.new/1
now requires a:module
option of the specific implementation to use, however the implementation has anew/1
that infers this when creating new intervals.
- The idea of a "zero" point was removed because it doesn't make sense for all intervals.
- Removed the
Interval.Point
protocol in favor of a behaviour for the entire interval. - Removed
Interval.size/2
- Added
Interval.size/2
. - Added parameterized typespec
t:Interval.t/1
- The internal
Endpoint
struct has been replaced by a simple 2-tuple. - Empty intervals are now represented by two identical exclusive points.
- Fixed a bug in
Interval.intersection/2
andInterval.union/2
that causes incorrect bounds in some cases.
- Fixed a correctness bug in intersection, where intersections between intervals containing unbounded endpoints would be incorrectly computed.