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

Cmd.Repl

Description

Process a textual language, which may look familiar, to perform UI state changes.

The incoming commands are received via Msg.Socket msgs.

TODO currently this will reload any updated modules as interpreted. While I want to do this for explicitly named modules (Cmd.Repl.Environ and LocalRepl *.hs), it's just annoying and brittle when applied to the main src files. Is there a way to get ghc to load the objects even if the source files are newer?

Synopsis

Documentation

with_socket :: (Socket.Socket -> IO.IO a) -> IO.IO a Source #

Acquire a new unix socket, and delete when done.

This tries to find an unused socket name. It might seem like overkill, but the previous strategy of unconditionally deleting and recreating the single socket meant that accidentally starting the app twice in the same directory would make the first one unreachable.

type Session = ReplImpl.Session Source #

This is the persistent interpreter session which is stored in the global state.

interpreter :: Session -> IO.IO () Source #

This is the interpreter thread, which should be started when the app starts. It's in a separate thread so it can run in its own monad.

accept_msg :: Socket.Socket -> IO.IO (Maybe (Handle, ReplProtocol.Query)) Source #

Block and read a single message from the REPL client, and return it along with a response handle. The Query should eventually make it's way to respond.