Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Cmd.Repl.Global

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

class Return a where Source #

The result of a REPL Cmd is converted to a ReplProtocol.Result with this method.

Minimal complete definition

_to_result

Instances
Return () # 
Instance details

Defined in Cmd.Repl.Global

Show a => Return a # 
Instance details

Defined in Cmd.Repl.Global

Return String # 
Instance details

Defined in Cmd.Repl.Global

Return Text # 
Instance details

Defined in Cmd.Repl.Global

Return ReplProtocol.Result # 
Instance details

Defined in Cmd.Repl.Global

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.

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

Called from logview

highlight_error :: Stack.UiFrame -> Cmd.CmdL () Source #

I used to use error_selnum for this, but it could be hard to find. Maybe the normal selection is more convenient, since I can zoom in on it, or move it around to find it.

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.

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.

data Replacement Source #

Constructors

F !Int

field from match

Instances
Eq Replacement # 
Instance details

Defined in Cmd.ModifyEvents

Show Replacement # 
Instance details

Defined in Cmd.ModifyEvents

IsString Replacement # 
Instance details

Defined in Cmd.ModifyEvents

w :: Parser Source #

Match one token.

ws :: Parser Source #

Match 0 or more tokens.

ws1 :: Parser Source #

Match 1 or more tokens.