Module

trait Module

Module bridges three levels of abstraction:

  • API. Client code is written against an (MTL-style) API. What API a module provides is module-specific. For example, PropagationModule provides the nutcracker.Propagation API.
  • Instruction set. Low-level instructions which are able to express all of the API operations. We define program as the free monad over (a superset of) the instruction set. We consider a variation of free monads, util.FreeK, where the instructions can talk about (the type of) programs in which they are embedded. In the simplest case, there is a one-to-one mapping between the API operations and instructions. There are cases, however, when an API operation has to be split into multiple instructions.
  • Interpreter. Interprets (free) programs in terms of state transitions.
Companion:
object
class Object
trait Matchable
class Any

Type members

Types

type Lang[K[_], A]

Instructions set.

Instructions set.

Type parameters:
K

allows instructions to refer to the type of program in which they are embedded. That is, K will be instantiated into FreeK[F, ?], where F[_[_], _] is a superset of this instruction set (i.e. there is an injection from Lang to F).

type StateK[K[_]]

State that the interpreter operates on.

State that the interpreter operates on.

Type parameters:
K

Some states need to store programs or program-producing functions. This type parameter allows the state to talk about the type of programs. It will be instantiated into FreeK[F, ?], where F[_[_], _] is a superset of the instruction set Lang (i.e. there is an injection from Lang to F).

Value members

Abstract methods

def emptyK[K[_]]: StateK[K]