Safe Haskell | Safe-Inferred |
---|
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
- class Return a where
- _to_result :: a -> ReplProtocol.Result
- make_id :: Id.Ident a => Text -> Text -> a
- vid :: Text -> Id.ViewId
- bid :: Text -> Id.BlockId
- rid :: Text -> Id.RulerId
- tid :: Text -> Id.TrackId
- block :: Cmd.CmdL Id.BlockId
- track :: Cmd.CmdL Id.TrackId
- tracknum :: Cmd.CmdL TrackNum
- view :: Cmd.CmdL Id.ViewId
- ruler :: Cmd.CmdL Id.RulerId
- root :: Cmd.CmdL Id.BlockId
- ns :: Text -> Id.Namespace
- ($>) :: Functor f => f a -> (a -> b) -> f b
- (.>) :: (a -> b) -> (b -> c) -> a -> c
- pp :: Pretty.Pretty a => Cmd.CmdL a -> Cmd.CmdL Text
- quit :: Cmd.CmdL ()
- s :: String -> Cmd.CmdL ()
- highlight_error :: Stack.UiFrame -> Cmd.CmdL ()
- show_history :: Cmd.CmdL Text
- save :: Cmd.CmdL ()
- save_state :: Cmd.CmdL ()
- save_state_as :: FilePath -> Cmd.CmdL ()
- write_state :: FilePath -> Cmd.CmdL FilePath
- save_git :: Cmd.CmdL ()
- save_git_as :: FilePath -> Cmd.CmdL ()
- load :: FilePath -> Cmd.CmdL ()
- load_force :: FilePath -> Cmd.CmdL ()
- revert :: Cmd.CmdL ()
- revert_to :: String -> Cmd.CmdL ()
- collapse_track :: Id.BlockId -> TrackNum -> Cmd.CmdL ()
- expand_track :: Id.BlockId -> TrackNum -> Cmd.CmdL ()
- collapse :: TrackNum -> Cmd.CmdL ()
- expand :: TrackNum -> Cmd.CmdL ()
- data Replacement = F !Int
- w :: Parser
- ws :: Parser
- ws1 :: Parser
Documentation
The result of a REPL Cmd is converted to a ReplProtocol.Result
with
this method.
_to_result :: a -> ReplProtocol.Result Source #
Instances
Return ReplProtocol.Result Source # | |
Defined in Cmd.Repl.Global | |
Return Text Source # | |
Defined in Cmd.Repl.Global _to_result :: Text -> ReplProtocol.Result Source # | |
Return String Source # | |
Defined in Cmd.Repl.Global | |
Return () Source # | |
Defined in Cmd.Repl.Global _to_result :: () -> ReplProtocol.Result Source # | |
Show a => Return a Source # | |
Defined in Cmd.Repl.Global _to_result :: a -> ReplProtocol.Result Source # |
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")
bid :: Text -> Id.BlockId Source #
rid :: Text -> Id.RulerId Source #
tid :: Text -> Id.TrackId Source #
block :: Cmd.CmdL Id.BlockId Source #
Get the current focused block.
track :: Cmd.CmdL Id.TrackId Source #
Get the track under the selection.
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
.
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 default 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.
write_state :: FilePath -> Cmd.CmdL FilePath Source #
Like save_state
, but don't change Cmd.state_save_file
.
save_git_as :: FilePath -> Cmd.CmdL () Source #
Save to the given git repo and switch to saving incrementally.
load_force :: FilePath -> Cmd.CmdL () Source #
collapse_track :: Id.BlockId -> TrackNum -> Cmd.CmdL () Source #
expand_track :: Id.BlockId -> TrackNum -> Cmd.CmdL () Source #
data Replacement Source #
Instances
IsString Replacement Source # | |
Defined in Cmd.ModifyEvents fromString :: String -> Replacement # | |
Show Replacement Source # | |
Defined in Cmd.ModifyEvents showsPrec :: Int -> Replacement -> ShowS # show :: Replacement -> String # showList :: [Replacement] -> ShowS # | |
Eq Replacement Source # | |
Defined in Cmd.ModifyEvents (==) :: Replacement -> Replacement -> Bool # (/=) :: Replacement -> Replacement -> Bool # |