Skip to content

Haskell Interactive Mode Architecture

Chris Done edited this page May 9, 2014 · 4 revisions

This page is about the architecture of Haskell Interactive Mode, which should be helpful for curious users and prospective hackers.

How it works

Your Emacs will contain multiple sessions: one for each Haskell project you're working on. Each session is associated with a connected GHCi process and a REPL buffer.

             Emacs
            /     \
          /         \
    Session          Session
   /       \         /     \
Process  REPL     Process   REPL

When you open a Haskell file in a fresh project directory, it will prompt to start a new session for the enclosing directory containing a .cabal file. It will also start a GHCi process and open up an associated REPL buffer.

Command Protocol

There is a command queue which all communication with the GHCi process must go through:

Module 1 -> |*|
            | |
Module 2 -> |*|
            \_/---------> Process
                            |
Module 3  <--------*--------'

Only one command can run at once, anything else is queued up.

Code architecture

This mode consists of a few modules:

Clone this wiki locally