Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Cmd.Repl.Global

Contents

Description

Helper functions to be imported into Cmd.Repl.Environ. Cmd.Repl.Environ must be interpreted since it's the "top level" module, so I put the library of commands in here. An unqualified import in Cmd.Repl.Environ means this module is in scope at the REPL.

Of course, REPL commands can use anything in scope in Cmd.Repl.Environ, not just these helpers. That includes all the various cmd_* functions used by the keybindings and everything in State. Also, keybindings can be invoked directly with the keybinding helper. TODO not implemented

Functions which are not designed to be composed generally take simpler types like strings, or get their block from the current focus, so they're easier to type.

To keep this module from getting huge, only general purpose and common cmds should go here. Cmds which are meant to be used from the REPL but may be more specialized can go in Cmd.Repl.L* modules.

Synopsis

Documentation

make_id :: Id.Ident a => Text -> Text -> a Source #

Take a string and automatically figure out what kind of ID is expected and add a namespace if one was not already in the string.

Throws an error if the ID has bad characters, which is ok since this is expected to be used from the REPL.

This is used by the REPL's macro feature, to replace xyz with (make_id "current-namespace" "xyz")

block :: Cmd.CmdL Id.BlockId Source #

Get the current focused block.

track :: Cmd.CmdL Id.TrackId Source #

Get the track under the selection.

view :: Cmd.CmdL Id.ViewId Source #

Get the current focused view.

ruler :: Cmd.CmdL Id.RulerId Source #

RulerId of the ruler under the selection.

root :: Cmd.CmdL Id.BlockId Source #

Get the root block.

ns :: Text -> Id.Namespace Source #

Create a namespace, and throw an IO exception if it has bad characters. Intended to be used from the REPL, where throwing an IO exception is ok.

($>) :: Functor f => f a -> (a -> b) -> f b infixl 1 Source #

Some oprators to more conveniently string together monadic and non-monadic functions in the REPL.

For instance:

     block >>= LPerf.get_midi_cache $> Midi.Cache.cache_chunks
             .> (!!1) .> Midi.Cache.chunk_state .> Perform.state_postproc

(.>) :: (a -> b) -> (b -> c) -> a -> c infixl 9 Source #

The REPL puts haskell in your sequencer, so you can compose while you compose.

pp :: Pretty.Pretty a => Cmd.CmdL a -> Cmd.CmdL Text Source #

Pretty-print the result of a cmd with Pretty.format.

errors

s :: String -> Cmd.CmdL () Source #

Called from logview

show / modify cmd state

load / save

save_state :: Cmd.CmdL () Source #

Save to the given filename and switch to saving plain states.

save_state_as :: FilePath -> Cmd.CmdL () Source #

Save to the given filename and switch to saving plain states.

save_git_as :: FilePath -> Cmd.CmdL () Source #

Save to the given git repo and switch to saving incrementally.

called externally

collapse :: TrackNum -> Cmd.CmdL () Source #

Called from logview.

expand :: TrackNum -> Cmd.CmdL () Source #

Called from logview.

change_instrument :: Text -> Cmd.CmdL () Source #

Called from the browser.