Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



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.



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 #