Safe Haskell | Safe-Inferred |
---|
Ad-hoc parsing for note tracks. This is a bit hacky because it's trying to guess syntactically how an expression will be evaluated, but it's convenient to do it this way, because otherwise I need to either have a special kind of evaluation, or I need to have evaluate emit metadata, and then wait for a full derive to complete. In addition, expressions that are being edited might not parse, or their caller might fail, or something.
Synopsis
- track_block_calls :: Ui.M m => Bool -> Id.BlockId -> Id.TrackId -> m [(Event.Event, NonEmpty Id.BlockId)]
- expr_block_calls :: Ui.M m => Bool -> Id.BlockId -> Text -> m [Id.BlockId]
- block_calls_of :: Bool -> (Text -> Maybe a) -> Text -> [a]
- get_to_block_id :: Ui.M m => Maybe Id.BlockId -> m (Text -> Maybe Id.BlockId)
- to_block_id :: Map Id.BlockId a -> Id.Namespace -> Maybe Id.BlockId -> Text -> Maybe Id.BlockId
- possible_block_calls :: Text -> [Text]
Documentation
track_block_calls :: Ui.M m => Bool -> Id.BlockId -> Id.TrackId -> m [(Event.Event, NonEmpty Id.BlockId)] Source #
expr_block_calls :: Ui.M m => Bool -> Id.BlockId -> Text -> m [Id.BlockId] Source #
:: Bool | If True, and the call wasn't a block, see if any
of the arguments name blocks. This is for calls like |
-> (Text -> Maybe a) | |
-> Text | |
-> [a] |
Try to to figure out any blocks that are referenced in the expression.
This doesn't use the full Derive.Parse machinery, but is simple and doesn't require the text to be fully parseable.
get_to_block_id :: Ui.M m => Maybe Id.BlockId -> m (Text -> Maybe Id.BlockId) Source #
to_block_id :: Map Id.BlockId a -> Id.Namespace -> Maybe Id.BlockId -> Text -> Maybe Id.BlockId Source #
If the first word names a block, then it's probably a block call with args, so return just that. Otherwise, return any argument that names a block.
possible_block_calls :: Text -> [Text] Source #