Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone



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.



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.

Eq Skeleton # 
Instance details

Defined in Ui.Skeleton

Read Skeleton # 
Instance details

Defined in Ui.Skeleton

Show Skeleton # 
Instance details

Defined in Ui.Skeleton

Pretty Skeleton # 
Instance details

Defined in Ui.Skeleton

Serialize.Serialize Skeleton # 
Instance details

Defined in Ui.Skeleton

type Edge = (TrackNum, TrackNum) Source #

This is (parent, child).

to_forest Source #


:: 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.