{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreierexrvw5zyx5u6tinvfw6myvslke2f3gaqajmvyfbqz24szkg44u",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mlcdp7jg6he2"
  },
  "path": "/t/ann-interval-patterns-0-8-2/14044#post_10",
  "publishedAt": "2026-05-07T23:09:13.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "Thanks for the interest and for sharing `closed-intervals`!\n\nTo answer your questions:\n\n`Data.Calendar` is meant for performing calculations based on the number of overlapping events are occurring. For example, calculating the share of a client account that is split between different sales representatives over time.\n\nI give the implementation\n\n\n    instance (Ord x) => Ord (Interval x) where\n      compare :: (Ord x) => Interval x -> Interval x -> Ordering\n      compare i1 i2 = on compare lower i1 i2 <> on compare upper i1 i2\n\n\nwhich is indeed `EQ` on `Identical` intervals. This ordering allows sorting in such a way that algorithms can take advantage of the `adjacency` of subsequent intervals, which I do in the internals of `Layers`. The `nestingsAsc` function combines overlapping intervals in such a way that the resulting list is disjoint and also sorted according to this order.\n\nI have indeed defined the function\n\n\n    hausdorff :: (Ord x, Num x) => Interval x -> Interval x -> Maybe x\n    hausdorff i1 i2 = case adjacency i1 i2 of\n      Before (_ :---: a) (b :---: _) -> levMaybe $ liftA2 (-) b a\n      After (_ :---: a) (b :---: _) -> levMaybe $ liftA2 (-) b a\n      _ -> Just 0\n     where\n      levMaybe = foldLevitated Nothing Just Nothing\n\n\nIt seems simpler to me, this way, than translating `hoare` and `smyth` into the language of `Interval`s that this library uses.",
  "title": "[ANN] interval-patterns-0.8.2"
}