úÎ/M,ü     #Region quadtrees with lens support.(c) Ashley Moni, 2014GPL-3$Ashley Moni <ashley.moni1@gmail.com>StableSafeHMEach ! is a tuple of an element from a  and the  it subtends.6Rectangular area, represented by a tuple of four Ints.<They correspond to (X floor, Y floor, X ceiling, Y ceiling).MThe co-ordinates are inclusive of all the rows and columns in all four Ints.regionArea (x, y, x, y) == 1The eponymous data type.Ž is itself a wrapper around an internal tree structure along with spatial metadata about the boundaries and depth of the 2D area it maps to.)Tuple corresponds to (X, Y) co-ordinates.ALens for accessing and manipulating data at a specific location.This is simply  and  wrapped into a lens./Getter for the value at a given location for a ./Setter for the value at a given location for a ."This automatically compresses the ' nodes if possible with the new value. Checks if a  is outside the boundaries of a .Dimensions of a , as an Int pair. #Cleanup function for use after any .When elements of a  are modified by  (or the _ lens), it automatically compresses identical adjacent nodes into larger ones. This keeps the " from bloating over constant use.- does not do this. If you wish to treat the  as a R, you should compose this function after to collapse it down to its minimum size. Example:    $  fn tree ; This particular example is reified in the function below. tmap is simply  with   applied after.'tmap fn tree == fuseTree $ fmap fn tree Takes a list of Ts and then decomposes them into a list of all their elements, properly weighted by  size. Returns a list of s. The block equivalent of .  Decomposes a  into its constituent s, before folding a % consuming function over all of them.>Simple helper function that lets you calculate the area of a , usually for  purposes.&Does the region contain this location? s a list of the  's elements.s a list of the  's elements. s a list of the s of a .s a list of the s of a .Constructor that generates a F of the given dimensions, with all cells filled with a default value.4Generates a newline delimited string representing a  as a 2D block of characters.Note that despite the word & in the function name, this does not   the >. It pretty prints it. The name is simply a mnemonic for its  -> String behaviour.As  above, but also prints it.+ (Length, Width)!"#$ % & '()(Length, Width)Initial element to fill*Function to generate characters for each  element.*Function to generate characters for each  element.*+,   $ !"#$ % & '()*+,-   !"#$#% &'()*+,-./0123456789:QuadTree-0.10.1 Data.QuadTree Control.MonadfmapFunctor Data.FoldabletoList Data.List replicatefilterTextshowTileRegionQuadTreeLocation atLocation getLocation setLocation outOfBoundstreeDimensionsfuseTreetmapexpandtile foldTiles regionAreainRegion filterTree sortTreeBy filterTiles sortTilesBymakeTreeshowTree printTreebasesortByGHC.ShowQuadrantNodeLeafWrapper wrappedTree treeLength treeWidth treeDepth offsetIndexoffsetsfuseonQuads fuseQuadsfoldTree treeRegion boundariesregionIntersection$fFunctorQuadrant$fFoldableQuadTree$fFunctorQuadTree