Backend (Haskell)

The main application for the backend follows the design of the Haskell Language Server (reactor pattern), it is built using a generic way of handling JSON-RPC inspired by Servant's named routes.

At the core of the backend is the recalculation engine based on build1. It is responsible for handling incremental recomputations and dependency tracking for languages implementing the Recalc interface. Its main function is recalc, used by:

  1. The Recalc.Repl driver (used for tests)
  2. The Recalc.Univer driver which provides a convenience function univerMain

The latter will run a language server which implements the protocol understood by the frontend.

Packages

  • recalc-engine: The core recalculation engine, includes a (preliminary) implementation for a dependency map, the document store (keeping track of files and their sheets). It defines the Recalc interfaces and provides the Fetch monad.

  • recalc-server: A generic implementation for named handlers (from Servant-like protocol definition 2) of JSON-RPC for generic running language servers.

  • recalc-univer: A generic backend implementation for a language server talking to the Univer frontend. It deals with dispatching the right operations and implements the Univer.Protocol.


  1. Andrey Mokhov, Neil Mitchell, Simon Peyton Jones. Build Systems à la Carte

  2. For more details refer to the blog post Named Routes in Servant