Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



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.


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 #


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