External Publication
Visit Post

[ANN] interval-patterns-0.8.2

Haskell Community [Unofficial] May 11, 2026
Source

So (4 :||: 0) and (0 :||: 4) are treated identical. But this is only because the pattern :||: swaps bounds if they are not in order. I tried to mentally trace the execution in the source code of adjacency for the un-swapped bounds and determined the (LT,GT) case to match, because

lower i1 < lower i2 -- 2 < 4
upper i1 > upper i2 -- 3 > 0

It might be worth mentioning in the documentation that all exported patterns will swap bounds if necessary.

Can you please explain what the open-open constructor pattern :<>: does in case the bounds are identical? The source reads almost as if 0 :<>: 0 yields a closed singleton interval, while I would expect that

(Leviate x) `within` (x :<>: y)

to be always false.

Discussion in the ATmosphere

Loading comments...