External Publication
Visit Post

[ANN] interval-patterns-0.8.2

Haskell Community [Unofficial] May 8, 2026
Source

mixphix:

It seems simpler to me, this way, than translating hoare and smyth into the language of Intervals that this library uses.

Of course there must be a shortcut for intervals over general sets. I only mentioned it because in some situations, users might not wish to distinguish between all constructors of Adjacency, but instead question a modality, such as “Is there a point within x that is less than/greater than all points in y?” that is witnessed by more than one constructor.

mixphix:

which is indeed EQ on Identical intervals.

So compare i1 i1 == EQ if and only if adjacency i1 i2 == Identical i1?, Which of the other 12 cases of Adjacency count as LT and which as GT, then? Does the Ord instance satisfy reflexivity, transitivity and antisymmetry? I see no tests regarding that.

mixphix:

The nestingsAsc function combines overlapping intervals in such a way that the resulting list is disjoint and also sorted according to this order.

But you do have to take into account that the behaviour of Data.Map (used in Layers) is undefined if used with a type that has a non-lawful Ord instance. Nasty bugs can arise, such as

  • inserts unexpectedly dropping elements
  • look-ups not turning up elements that are present

In closed-intervals I implemented an interval tree, which decorates each internal node with the convex hull of the sub-tree. You might also want to take a look at sortByRight and and NonNestedSeq which is a simple search structure that works correctly given a certain nesting assumption.

Discussion in the ATmosphere

Loading comments...