Fast and flexible k-d trees for various types of point queries. https://github.com/giogadi/kdt

Version on this page:0.2.2
LTS Haskell 15.15:0.2.4
Stackage Nightly 2020-06-06:0.2.4
Latest on Hackage:0.2.4

See all snapshots kdt appears in

MIT licensed by Luis G. Torres
Maintained by [email protected]

Module documentation for 0.2.2

This version can be pinned in stack with:[email protected]:0d9a903ec8a0d4a8ea09bbc728d5e38c0f3aafd1ade2c04479ff2f81ebe3612f,3532
  • Data
    • Data.KdMap
      • Data.KdMap.Dynamic
      • Data.KdMap.Static
    • Data.KdTree
      • Data.KdTree.Dynamic
      • Data.KdTree.Static

This package includes static and dynamic versions of k-d trees, as well as "Map" variants that store data at each point in the k-d tree structure. Supports nearest neighbor, k nearest neighbors, points within a given radius, and points within a given range. To learn to use this package, start with the documentation for the Data.KdTree.Static module.



  • Relax lower version bound on QuickCheck to 2.5.


  • Relax upper version constraint for MonadRandom (benchmarking code)
  • Add Data.Point2d as dependency of executables so tests and benchmarks can be built from the archive downloaded on Hackage.


  • Lots and lots of renaming all throughout to more closely match terminology used in containers.
  • Removed kdt library dependency on QuickCheck (if not building testing code).
  • Removed testing module Point2d from public API
  • All structures now have Show instance
  • Static variants now have functions for dynamically inserting new points into existing structure, with caveat that these functions do not maintain balanced tree structure.