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

Safe HaskellNone

Derive.Stack

Contents

Synopsis

Documentation

data Stack Source #

The Stack is read in both inner -> outer and outer -> inner order. Since it's always modified at the innermost end, I keep it in inner -> outer order.

I originally used Data.Sequence but it generates more garbage and I couldn't figure out how to stop that from happening.

from_outermost :: [Frame] -> Stack Source #

Construct a Stack from frames starting with the outermost and ending with the innermost.

from_innermost :: [Frame] -> Stack Source #

Construct a Stack from frames starting with the innermost and ending with the outermost.

block :: Id.BlockId -> Stack Source #

Make a Stack with a single block.

call :: Text -> Stack Source #

Make a Stack with a single call.

add :: Frame -> Stack -> Stack Source #

Add the frame to the innermost end of the stack.

outermost :: Stack -> [Frame] Source #

The stack, starting with the outermost call and ending with the innermost. All display should use this order.

innermost :: Stack -> [Frame] Source #

The stack, starting with the innermost call and ending with the outermost.

block_track_of :: Stack -> Maybe (Id.BlockId, Id.TrackId) Source #

Walk up the stack to discover the innermost TrackId, then BlockId.

block_track_region_of :: Stack -> Maybe (Id.BlockId, Id.TrackId, (ScoreTime.TrackTime, ScoreTime.TrackTime)) Source #

Walk up the stack to discover the innermost Region, TrackId, then BlockId.

match :: Pattern -> Stack -> Bool Source #

type Serial = Int Source #

The Stack is used as a unique key for a unique call of a generator. For instance, the cache uses it to cache generator output, and the random mechanism uses it to permute seed. Since a single track event may call multiple generators internally, each one is given a unique serial number.

pretty_ui_inner :: Stack -> Maybe Text Source #

Loggable msg with the last position of the stack.

log_ui_frame :: UiFrame -> Text Source #

Format a UiFrame for logging. This means it wraps it in {s "..."}, which causes logview to make it clickable, which will highlight the stack location.

more specialized utils

track_regions :: Stack -> Id.TrackId -> [Ranges.Ranges ScoreTime.TrackTime] Source #

Get the Regions associated with a track in a given stack. It's a little tricky because track level calls will go in between the track and the region, e.g. [track, call, call, region].

ui

type UiFrame = (Maybe Id.BlockId, Maybe Id.TrackId, Maybe (ScoreTime.TrackTime, ScoreTime.TrackTime)) Source #

This is an abbreviation of the stack that only has elements that are visible in the UI.

(block_id, track_id, (event_start, event_end))

to_ui :: Stack -> [UiFrame] Source #

UiFrames are returned in outermost to innermost order.

unparse_ui_frame :: UiFrame -> Text Source #

These functions are used by LogView and Cmd.Repl.*, but are here since both places import this module. Examples:

"untitled/b0 untitled/b0.t2 0-.25"
"untitled/b0 foo/bar *"
"untitled/b0 * *"

unparse_ui_frame_ :: UiFrame -> Text Source #

This is like unparse_ui_frame except it omits the namespaces for a less cluttered but potentially ambiguous output.