Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

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
Eq Query # 
Instance details

Defined in App.ReplProtocol

Methods

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

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

Show Query # 
Instance details

Defined in App.ReplProtocol

Methods

showsPrec :: Int -> Query -> ShowS #

show :: Query -> String #

showList :: [Query] -> ShowS #

Pretty Query # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize Query # 
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
Eq NotifySeq # 
Instance details

Defined in App.ReplProtocol

Show NotifySeq # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize NotifySeq # 
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
Eq Response # 
Instance details

Defined in App.ReplProtocol

Show Response # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize Response # 
Instance details

Defined in App.ReplProtocol

data CmdResult Source #

Constructors

CmdResult !Result ![Log.Msg] 

Instances

Instances details
Eq CmdResult # 
Instance details

Defined in App.ReplProtocol

Show CmdResult # 
Instance details

Defined in App.ReplProtocol

DeepSeq.NFData CmdResult # 
Instance details

Defined in App.ReplProtocol

Methods

rnf :: CmdResult -> () #

Serialize.Serialize CmdResult # 
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
Eq Result # 
Instance details

Defined in App.ReplProtocol

Methods

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

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

Show Result # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize Result # 
Instance details

Defined in App.ReplProtocol

Return Result # 
Instance details

Defined in Cmd.Repl.Global

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
Eq Editor # 
Instance details

Defined in App.ReplProtocol

Methods

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

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

Show Editor # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize Editor # 
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
Eq File # 
Instance details

Defined in App.ReplProtocol

Methods

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

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

Show File # 
Instance details

Defined in App.ReplProtocol

Methods

showsPrec :: Int -> File -> ShowS #

show :: File -> String #

showList :: [File] -> ShowS #

Serialize.Serialize File # 
Instance details

Defined in App.ReplProtocol

data FileType Source #

Constructors

NoType 
Ky 
TScore 

Instances

Instances details
Bounded FileType # 
Instance details

Defined in App.ReplProtocol

Enum FileType # 
Instance details

Defined in App.ReplProtocol

Eq FileType # 
Instance details

Defined in App.ReplProtocol

Show FileType # 
Instance details

Defined in App.ReplProtocol

Serialize.Serialize FileType # 
Instance details

Defined in App.ReplProtocol

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 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.