Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Ui.GenId

Description

Utilities to create a non-colliding Id, using the standard naming scheme. It should be passed to the apppropriate create funciton, e.g. Ui.create_block to make a BlockId.

Synopsis

Documentation

generate_view_id :: Id.BlockId -> Map Id.ViewId _a -> Maybe Id.Id Source #

ViewIds look like "nsb0.v0", "nsb0.v1", etc.

generate_id :: Ord a => Id.Namespace -> Id.Id -> Text -> (Id.Id -> a) -> Map a _b -> Maybe Id.Id Source #

track_id_at :: Id.BlockId -> TrackNum -> Id.TrackId Source #

Guess a TrackId generated from GenId. Useful for tests.

ids_for :: Id.Namespace -> Text -> Text -> [Id.Id] Source #

IDs are numbered, and they start at 1 instead of 0.

This is because usually tracknum 0 is the ruler, so counting with tracknums, event tracks start at 1. The actual TrackId should be irrelevant (and would be out of date as soon as a track is swapped), but for testing it's very convenient if they line up with the tracknums. So even though it's purely for testing and only for TrackIds, I start everything at 1 just for consistency.

require_id :: Ui.M m => Text -> Maybe a -> m a Source #