Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

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

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

Constructors

Skeleton Graph.Graph 

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.

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

Constructors

Skeleton Graph.Graph 

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.