Safe Haskell | Safe-Inferred |
---|
Evaluate tracklang expressions.
Synopsis
- eval_toplevel :: CallableExpr d => Context d -> DeriveT.Expr -> Deriver (Stream.Stream d)
- eval_quoted :: CallableExpr d => Context d -> DeriveT.Quoted -> Deriver (Stream.Stream d)
- eval_quoted_normalized :: CallableExpr d => Context d -> DeriveT.Quoted -> Deriver (Stream.Stream d)
- eval_expr_val :: CallableExpr d => Context d -> Expr.Expr Expr.MiniVal -> Deriver (Stream.Stream d)
- apply_generator :: Context d -> Generator d -> [DeriveT.Val] -> Deriver (Stream.Stream d)
- eval_transformers :: (Callable (Transformer d), Taggable d) => Context d -> [DeriveT.Call] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d)
- eval_transform_expr :: (Callable (Transformer d), Taggable d) => Text -> Text -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d)
- apply_transformer :: Context d -> Transformer d -> [DeriveT.Val] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d)
- apply_transformers :: Context d -> [(Transformer d, [DeriveT.Val])] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d)
- eval_quoted_transformers :: (Callable (Transformer d), Taggable d) => Context d -> DeriveT.Quoted -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d)
- eval :: Taggable a => Context a -> DeriveT.Term -> Deriver DeriveT.Val
- apply :: Context Tagged -> ValCall -> [DeriveT.Term] -> Deriver DeriveT.Val
- get_val_call :: Expr.Symbol -> Deriver ValCall
- get_generator :: forall d. Callable (Generator d) => Expr.Symbol -> Deriver (Generator d)
- get_transformer :: forall d. Callable (Transformer d) => Expr.Symbol -> Deriver (Transformer d)
- get_track_call :: forall d. Callable (TrackCall d) => Expr.Symbol -> Deriver (TrackCall d)
- unknown_symbol :: Text -> Expr.Symbol -> Text
- call_to_block_id :: Id.Namespace -> Maybe Id.BlockId -> Expr.Symbol -> Maybe Id.BlockId
- block_id_to_call :: Bool -> Id.BlockId -> Id.BlockId -> Text
- is_relative :: Expr.Symbol -> Bool
- make_relative :: Id.BlockId -> Text -> Text
- parse_relative_id :: Id.BlockId -> Maybe (Id.BlockId, Id.Id)
- eval_one :: CallableExpr d => Bool -> DeriveT.Expr -> Deriver (Stream.Stream d)
- eval_one_call :: CallableExpr d => Bool -> DeriveT.Call -> Deriver (Stream.Stream d)
- eval_one_at :: CallableExpr d => Bool -> ScoreTime -> ScoreTime -> DeriveT.Expr -> Deriver (Stream.Stream d)
- eval_event :: CallableExpr d => Event.Event -> Deriver (Either Text (Stream.Stream d))
- reapply_generator :: Callable (Generator d) => PassedArgs d -> Expr.Symbol -> Deriver (Stream.Stream d)
- reapply_generator_normalized :: Callable (Generator d) => PassedArgs d -> Expr.Symbol -> Deriver (Stream.Stream d)
- reapply :: CallableExpr d => Context d -> DeriveT.Expr -> Deriver (Stream.Stream d)
- reapply_call :: CallableExpr d => Context d -> Expr.Symbol -> [DeriveT.Term] -> Deriver (Stream.Stream d)
- eval_pitch :: ScoreTime -> DeriveT.PitchCall -> Deriver (DeriveT.RawPitch a)
- eval_note :: Scale -> Pitch.Note -> Deriver (DeriveT.RawPitch a)
- apply_pitch :: ScoreTime -> ValCall -> Deriver (DeriveT.RawPitch a)
- eval_expr :: CallableExpr d => Bool -> Context d -> DeriveT.Expr -> Deriver (Stream.Stream d)
eval / apply
eval_toplevel :: CallableExpr d => Context d -> DeriveT.Expr -> Deriver (Stream.Stream d) Source #
Apply a toplevel expression.
eval_quoted :: CallableExpr d => Context d -> DeriveT.Quoted -> Deriver (Stream.Stream d) Source #
eval_quoted_normalized :: CallableExpr d => Context d -> DeriveT.Quoted -> Deriver (Stream.Stream d) Source #
This is like eval_quoted
, except that the ctx_event
is set to
(0, 1) normalized time. This is important if you want to place the
resulting deriver. Otherwise, you can use eval_quoted and the event's
position will fall through to the callee.
TODO this awkwardness is because events evaluate in track time, not in normalized time. Details in Derive.EvalTrack.
eval_expr_val :: CallableExpr d => Context d -> Expr.Expr Expr.MiniVal -> Deriver (Stream.Stream d) Source #
Eval a Expr MiniVal, which is produced by Expr.ToExpr
.
generator
apply_generator :: Context d -> Generator d -> [DeriveT.Val] -> Deriver (Stream.Stream d) Source #
Like eval_generator
, but for when the args are already parsed and
evaluated. This is useful when one generator wants to dispatch to another.
transformer
eval_transformers :: (Callable (Transformer d), Taggable d) => Context d -> [DeriveT.Call] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #
eval_transform_expr :: (Callable (Transformer d), Taggable d) => Text -> Text -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #
Parse and apply a transformer expression.
apply_transformer :: Context d -> Transformer d -> [DeriveT.Val] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #
The transformer version of apply_generator
. Like eval_transformers
,
but apply only one, and apply to already evaluated DeriveT.Val
s. This
is useful when you want to re-apply an already parsed set of vals.
apply_transformers :: Context d -> [(Transformer d, [DeriveT.Val])] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #
A list version of apply_transformer
.
eval_quoted_transformers :: (Callable (Transformer d), Taggable d) => Context d -> DeriveT.Quoted -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #
The same as eval_transformers
, but get them out of a Quoted.
val calls
eval :: Taggable a => Context a -> DeriveT.Term -> Deriver DeriveT.Val Source #
apply :: Context Tagged -> ValCall -> [DeriveT.Term] -> Deriver DeriveT.Val Source #
get_val_call :: Expr.Symbol -> Deriver ValCall Source #
lookup call
get_generator :: forall d. Callable (Generator d) => Expr.Symbol -> Deriver (Generator d) Source #
get_transformer :: forall d. Callable (Transformer d) => Expr.Symbol -> Deriver (Transformer d) Source #
get_track_call :: forall d. Callable (TrackCall d) => Expr.Symbol -> Deriver (TrackCall d) Source #
unknown_symbol :: Text -> Expr.Symbol -> Text Source #
:: Id.Namespace | |
-> Maybe Id.BlockId | If the symbol starts with -, this block is prepended to it. |
-> Expr.Symbol | |
-> Maybe Id.BlockId |
Given a Symbol, try to come up with the BlockId of the block it could be a call for.
block_id_to_call :: Bool -> Id.BlockId -> Id.BlockId -> Text Source #
Create the symbol to call a given block.
relative calls
is_relative :: Expr.Symbol -> Bool Source #
True if this is a relative block call.
make_relative :: Id.BlockId -> Text -> Text Source #
Make a block name relative to a parent block.
parse_relative_id :: Id.BlockId -> Maybe (Id.BlockId, Id.Id) Source #
If it's a relative BlockId, return the parent and relative call.
util
eval_one :: CallableExpr d => Bool -> DeriveT.Expr -> Deriver (Stream.Stream d) Source #
Evaluate a single note as a generator. Fake up an event with no prev or next lists.
eval_one_call :: CallableExpr d => Bool -> DeriveT.Call -> Deriver (Stream.Stream d) Source #
eval_one_at :: CallableExpr d => Bool -> ScoreTime -> ScoreTime -> DeriveT.Expr -> Deriver (Stream.Stream d) Source #
eval_event :: CallableExpr d => Event.Event -> Deriver (Either Text (Stream.Stream d)) Source #
Like derive_event
but evaluate the event outside of its
track context. This is useful if you want to evaluate things out of order,
i.e. evaluate the next pitch.
reapply_generator :: Callable (Generator d) => PassedArgs d -> Expr.Symbol -> Deriver (Stream.Stream d) Source #
Evaluate a generator, reusing the passed args but replacing the Symbol. Generators can use this to delegate to other generators.
reapply_generator_normalized :: Callable (Generator d) => PassedArgs d -> Expr.Symbol -> Deriver (Stream.Stream d) Source #
Like reapply_generator
, but the note is given normalized time, 0--1,
instead of inheriting the start and duration from the args. This is
essential if you want to shift or stretch the note.
reapply :: CallableExpr d => Context d -> DeriveT.Expr -> Deriver (Stream.Stream d) Source #
Apply an expr with an explicit Context. You can use this to reuse the
current call's Context, but be careful because it will also inherit the
ctx_sub_tracks
, which means if inversion hasn't happened yet, which
may be what you want or may be surprising. For instance, it will likely
override any pitch you try to set.
reapply_call :: CallableExpr d => Context d -> Expr.Symbol -> [DeriveT.Term] -> Deriver (Stream.Stream d) Source #
eval_pitch :: ScoreTime -> DeriveT.PitchCall -> Deriver (DeriveT.RawPitch a) Source #
A version of eval
specialized to evaluate pitch calls. It's unknown if
this pitch has been transposed or not.
eval_note :: Scale -> Pitch.Note -> Deriver (DeriveT.RawPitch a) Source #
Get a Pitch from in a given scale. Like eval_pitch
, it's unknown if
this pitch has been transposed or not.
apply_pitch :: ScoreTime -> ValCall -> Deriver (DeriveT.RawPitch a) Source #
This is like eval_pitch
when you already know the call, presumably
because you asked scale_note_to_call
.
:: CallableExpr d | |
=> Bool | See |
-> Context d | |
-> DeriveT.Expr | |
-> Deriver (Stream.Stream d) |
Evaluate a single expression, catching an exception if it throws.