Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Ui.Skeleton

Description

Operations on Skeletons.

A skeleton is a tree, but it's stored as a Data.Graph and converted to a tree when needed. This seems weird, but at the time it seemed overly awkward to add and remove edges to a tree, and to detect cycles, while graphs have those operations built in. In retrospect, dealing with Data.Graph was probably more of a pain, so maybe someday if I have a lot of extra time and feel like some aggravation I'll see about redoing Skeleton as a Tree. I could also maybe clean up Ui.TrackTree.

Synopsis

Documentation

data Skeleton Source #

The skeleton describes a hierarchical relationship between tracks. It's used at the UI level only to display the hierarchy visually, but the deriver level will presumably use it for derivation. A given track may appear multiple times or not at all.

Instances

Instances details
Read Skeleton Source # 
Instance details

Defined in Ui.Skeleton

Show Skeleton Source # 
Instance details

Defined in Ui.Skeleton

Eq Skeleton Source # 
Instance details

Defined in Ui.Skeleton

Pretty Skeleton Source # 
Instance details

Defined in Ui.Skeleton

Serialize.Serialize Skeleton Source # 
Instance details

Defined in Ui.Skeleton

type Edge = (TrackNum, TrackNum) Source #

This is (parent, child).

to_forest Source #

Arguments

:: TrackNum

Total number of tracks. This is needed because the underlying graph may be smaller than the number of tracks. I don't want to allow a skeleton that doesn't have certain tracks (and hence makes them invisible) so any missing tracks are appended.

-> Skeleton 
-> [Tree.Tree TrackNum]

Each list of Nodes is sorted so the tree appears in the same order as the tracks. This is essential for calls that want to deal with tracks left-to-right.

parents :: Skeleton -> TrackNum -> [TrackNum] Source #

Get the parents of a TrackNum.

insert :: TrackNum -> Skeleton -> Skeleton Source #

Increment all vertices at and above, insert new empty vertex.

remove :: TrackNum -> Skeleton -> Skeleton Source #

All vertices pointing to the removed vertex instead point to what it pointed to. All vertices above the removed one get (-1).

move :: TrackNum -> TrackNum -> Skeleton -> Skeleton Source #

If from<to, then from is inserted after to. If to<from, then from is inserted before to.