Quadtree implementation in Haskell