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

Derive.Stack

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.

Instances

Instances details
Read.Read Stack Source # 
Instance details

Defined in Derive.Stack

Show Stack Source # 
Instance details

Defined in Derive.Stack

Methods

showsPrec :: Int -> Stack -> ShowS #

show :: Stack -> String #

showList :: [Stack] -> ShowS #

DeepSeq.NFData Stack Source # 
Instance details

Defined in Derive.Stack

Methods

rnf :: Stack -> () #

Eq Stack Source # 
Instance details

Defined in Derive.Stack

Methods

(==) :: Stack -> Stack -> Bool #

(/=) :: Stack -> Stack -> Bool #

Ord Stack Source # 
Instance details

Defined in Derive.Stack

Methods

compare :: Stack -> Stack -> Ordering #

(<) :: Stack -> Stack -> Bool #

(<=) :: Stack -> Stack -> Bool #

(>) :: Stack -> Stack -> Bool #

(>=) :: Stack -> Stack -> Bool #

max :: Stack -> Stack -> Stack #

min :: Stack -> Stack -> Stack #

Pretty.Pretty Stack Source # 
Instance details

Defined in Derive.Stack

Serialize.Serialize Stack Source # 
Instance details

Defined in Derive.Stack

FromJSON Stack Source # 
Instance details

Defined in Derive.Stack

ToJSON Stack Source # 
Instance details

Defined in Derive.Stack

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_tracks_of :: Stack -> [(Id.BlockId, [Id.TrackId])] Source #

Get each block and the tracks under it, starting from the innermost.

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 #

data Frame Source #

Instances

Instances details
Read.Read Frame Source # 
Instance details

Defined in Derive.Stack

Show Frame Source # 
Instance details

Defined in Derive.Stack

Methods

showsPrec :: Int -> Frame -> ShowS #

show :: Frame -> String #

showList :: [Frame] -> ShowS #

DeepSeq.NFData Frame Source # 
Instance details

Defined in Derive.Stack

Methods

rnf :: Frame -> () #

Eq Frame Source # 
Instance details

Defined in Derive.Stack

Methods

(==) :: Frame -> Frame -> Bool #

(/=) :: Frame -> Frame -> Bool #

Ord Frame Source # 
Instance details

Defined in Derive.Stack

Methods

compare :: Frame -> Frame -> Ordering #

(<) :: Frame -> Frame -> Bool #

(<=) :: Frame -> Frame -> Bool #

(>) :: Frame -> Frame -> Bool #

(>=) :: Frame -> Frame -> Bool #

max :: Frame -> Frame -> Frame #

min :: Frame -> Frame -> Frame #

Pretty.Pretty Frame Source # 
Instance details

Defined in Derive.Stack

Seed.Seed Frame Source # 
Instance details

Defined in Derive.Stack

Methods

to_seed :: Int -> Frame -> Int Source #

Serialize.Serialize Frame Source # 
Instance details

Defined in Derive.Stack

FromJSON Frame Source # 
Instance details

Defined in Derive.Stack

ToJSON Frame Source # 
Instance details

Defined in Derive.Stack

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.