Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

App.ReplProtocol

Description

Define the protocol between the sequencer's repl port and the repl client.

Synopsis

types

data Query Source #

This is a simple RPC mechanism. Query goes to the server, which responds with the matching Response.

Constructors

QSaveFile 
QCommand !Text 
QCompletion !Text 
QNotify !NotifySeq

A notification doesn't have a corrpesponding Response.

Instances

Instances details
Show Query Source # 
Instance details

Defined in App.ReplProtocol

Methods

showsPrec :: Int -> Query -> ShowS #

show :: Query -> String #

showList :: [Query] -> ShowS #

Eq Query Source # 
Instance details

Defined in App.ReplProtocol

Methods

(==) :: Query -> Query -> Bool #

(/=) :: Query -> Query -> Bool #

Pretty Query Source # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize Query Source # 
Instance details

Defined in App.ReplProtocol

data NotifySeq Source #

Constructors

NEditorOpened

These are so the sequencer knows if there are open editors, so it can refuse to quit and hence orphan them.

NEditorClosed 

Instances

Instances details
Show NotifySeq Source # 
Instance details

Defined in App.ReplProtocol

Eq NotifySeq Source # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize NotifySeq Source # 
Instance details

Defined in App.ReplProtocol

data Response Source #

Constructors

RSaveFile !(Maybe IO.FilePath)

current save file

RCommand !CmdResult 
RCompletion ![Text]

possible completions for the prefix

Instances

Instances details
Show Response Source # 
Instance details

Defined in App.ReplProtocol

Eq Response Source # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize Response Source # 
Instance details

Defined in App.ReplProtocol

data CmdResult Source #

Constructors

CmdResult !Result ![Log.Msg] 

Instances

Instances details
Show CmdResult Source # 
Instance details

Defined in App.ReplProtocol

DeepSeq.NFData CmdResult Source # 
Instance details

Defined in App.ReplProtocol

Methods

rnf :: CmdResult -> () #

Eq CmdResult Source # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize CmdResult Source # 
Instance details

Defined in App.ReplProtocol

data Result Source #

Constructors

Raw !Text

Print this text directly, without formatting it.

Format !Text

Format and print.

Edit !(NonEmpty Editor)

Edit one or more files.

Instances

Instances details
Show Result Source # 
Instance details

Defined in App.ReplProtocol

Eq Result Source # 
Instance details

Defined in App.ReplProtocol

Methods

(==) :: Result -> Result -> Bool #

(/=) :: Result -> Result -> Bool #

Return Result Source # 
Instance details

Defined in Cmd.Repl.Global

Serialize.Serialize Result Source # 
Instance details

Defined in App.ReplProtocol

data Editor Source #

Open an editor locally.

How this works is that a Cmd will return the special Edit value, which will be specially interpreted in the repl to open an editor. The editor will be configured such that when it saves, it will send its buffer to the sequencer via a REPL function with a string argument (configured by _on_save). The text goes back separately via the send command, since the REPL itself will be blocked waiting for the editor to exit.

Constructors

Editor 

Fields

Instances

Instances details
Show Editor Source # 
Instance details

Defined in App.ReplProtocol

Eq Editor Source # 
Instance details

Defined in App.ReplProtocol

Methods

(==) :: Editor -> Editor -> Bool #

(/=) :: Editor -> Editor -> Bool #

Serialize.Serialize Editor Source # 
Instance details

Defined in App.ReplProtocol

data File Source #

Constructors

FileName !IO.FilePath

open this file

Text !FileType !Text

open this text in a temp file

Instances

Instances details
Show File Source # 
Instance details

Defined in App.ReplProtocol

Methods

showsPrec :: Int -> File -> ShowS #

show :: File -> String #

showList :: [File] -> ShowS #

Eq File Source # 
Instance details

Defined in App.ReplProtocol

Methods

(==) :: File -> File -> Bool #

(/=) :: File -> File -> Bool #

Serialize.Serialize File Source # 
Instance details

Defined in App.ReplProtocol

data FileType Source #

Constructors

NoType 
Ky 
TScore 

repl protocol

query_save_file :: Network.Addr -> IO.IO (Maybe (Maybe IO.FilePath)) Source #

Ask for the current save filename. Nothing for an error, and Just Nothing for no save file.

notify :: Network.Addr -> NotifySeq -> IO.IO (Either Exception.IOException ()) Source #

Like query, but don't expect a response.

query_cmd_simple :: Text -> IO.IO Text Source #

A simple one-shot query_cmd.

seq protocol

format

format_result :: CmdResult -> Text Source #

Format the response and strip trailing whitespace.