Safe Haskell | Safe-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.
Synopsis
- view_id :: Ui.M m => Id.BlockId -> m Id.Id
- block_id :: Ui.M m => Maybe Id.BlockId -> m Id.Id
- track_id :: Ui.M m => Id.BlockId -> m Id.Id
- generate_view_id :: Id.BlockId -> Map Id.ViewId a -> Maybe Id.Id
- generate_block_id :: Maybe Id.BlockId -> Id.Namespace -> Map Id.BlockId a -> Maybe Id.Id
- generate_track_id :: Id.BlockId -> Map Id.TrackId a -> Maybe Id.Id
- generate_id :: Ord a => Id.Namespace -> Id.Id -> Text -> (Id.Id -> a) -> Map a b -> Maybe Id.Id
- track_id_at :: Id.BlockId -> TrackNum -> Id.TrackId
- ids_for :: Id.Namespace -> Text -> Text -> [Id.Id]
- id_at :: Id.Namespace -> Text -> Text -> Int -> Id.Id
- require_id :: Ui.M m => Text -> Maybe a -> m a
Documentation
generate_view_id :: Id.BlockId -> Map Id.ViewId a -> Maybe Id.Id Source #
ViewIds look like "nsb0.v0", "nsb0.v1", etc.
generate_block_id :: Maybe Id.BlockId -> Id.Namespace -> Map Id.BlockId a -> Maybe Id.Id Source #
generate_track_id :: Id.BlockId -> Map Id.TrackId a -> Maybe Id.Id Source #
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.