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

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 #