drawingPart, DPath, et al

Drawing manipulation


drawingPart :: Drawing a b -> DPath -> Drawing a b
type DPath = [Int]
up :: DPath -> DPath
maybeDrawingPart :: Drawing a b -> DPath -> Maybe (Drawing a b)
replacePart :: Drawing a b -> DPath -> Drawing a b -> Drawing a b
updatePart :: Drawing a b -> DPath -> (Drawing a b -> Drawing a b) -> Drawing a b
mapLabelDrawing :: (a -> b) -> Drawing a c -> Drawing b c
deletePart :: Drawing a b -> [Int] -> Drawing a b
drawingAnnots :: Drawing a b -> [(DPath, a)]


These are functions that operate on parts of drawings.

Values of type DPath are used as references to parts of drawings. The function up returns the path of the parent of a node.

There are two functions for extracting a part with a given path. The function drawingPart fails if the path refers to a non-existing part. maybeDrawingPart returns Just part if the part exists, Nothing otherwise.

The functions replacePart and updatePart replace parts of drawings. They fail if the path refers to a non-existing part.

mapLabelDrawing applies a function to all the labels in a drawing.

deletePart deletes a part of a drawing.

drawingAnnots returns the paths and labels of the labelled nodes of a drawing.


replacePart drawing path newpart = updatePart drawing path (const newpart)

See Also

The types: Drawing, DPath.


This page documents work progress. Information on this page is subject to change without notice and does not represent a commitment on the part of the Fudgets corporation.