nutcracker.toolkit

Type members

Classlikes

class BFSSolver[Prg, S, M[_], C, A](interpreter: (Prg, S) => M[S], assess: S => List[Prg] \/ A, getCost: S => C)(implicit evidence$1: NonDecreasingMonoid[C], M: Monad[M])
sealed abstract class BranchLang[Ref[_], K[_], A]
Companion:
object
object BranchLang
Companion:
class
class BranchingListModule[Var0[_[_], _], Val0[_[_], _], Lang0[_[_], _], State0[_[_]]](base: Aux[Var0, Val0, Lang0, State0]) extends ListModule[Lang0, State0] with BranchingModule
trait BranchingModule extends Module
Companion:
object
Companion:
class
sealed trait CostLang[C, K[_], A]
Companion:
object
object CostLang
Companion:
class
class CostListModule[C, Lang0[_[_], _], State0[_[_]]](base: Aux[C, Lang0, State0]) extends ListModule[Lang0, State0] with CostModule[C]
trait CostModule[C] extends Module
Companion:
object
object CostModule
Companion:
class
trait CostRefToolkit[C] extends CostToolkit[C] with RefToolkit
trait CostToolkit[C] extends Toolkit
class DFSSolver[Prg, S, M[_], A](interpret: (Prg, S) => M[S], assess: S => List[Prg] \/ A)(implicit ev: StashRestore[S])
sealed trait DeferLang[D, K[_], A]
Companion:
object
object DeferLang
Companion:
class
class DeferListModule[D, Lang0[_[_], _], State0[_[_]]](base: Aux[D, Lang0, State0]) extends ListModule[Lang0, State0] with StashDeferModule[D]
trait DeferModule[D] extends Module
Companion:
object
Companion:
class
trait FreeToolkit extends Toolkit

A Toolkit whose representation of a program (Toolkit.Prg) is a free monad over some algebra (FreeToolkit.Lang).

A Toolkit whose representation of a program (Toolkit.Prg) is a free monad over some algebra (FreeToolkit.Lang).

FreeToolkit is typically created by composing multiple Modules.

class ListModule[Lang0[_[_], _], State0[_[_]]](base: Aux[Lang0, State0]) extends StashModule
trait Module

Module bridges three levels of abstraction:

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
object Module
Companion:
class
class OnDemandPropagationListModule[Var0[_[_], _], Val0[_[_], _], Out0[_[_], _], Lang0[_[_], _], State0[_[_]]](base: Aux[Var0, Val0, Out0, Lang0, State0]) extends PropagationListModule[Var0, Val0, Out0, Lang0, State0] with StashOnDemandPropagationModule
Companion:
class
Companion:
class
Companion:
object
Companion:
class
Companion:
class
class PropagationListModule[Var0[_[_], _], Val0[_[_], _], Out0[_[_], _], Lang0[_[_], _], State0[_[_]]](base: Aux[Var0, Val0, Out0, Lang0, State0]) extends ListModule[Lang0, State0] with StashPropagationModule
Companion:
object
Companion:
class
Companion:
object
Companion:
class
trait RefToolkit extends Toolkit

Extends Toolkit with a notion of observable (RefToolkit.Val) and writable (RefToolkit.Var) cells, (potentially) residing inside RefToolkit.State.

Extends Toolkit with a notion of observable (RefToolkit.Val) and writable (RefToolkit.Var) cells, (potentially) residing inside RefToolkit.State.

trait RelModule extends Module
Companion:
object
object RelModule
Companion:
class
trait RelToolkit extends Toolkit
trait StashDeferModule[D] extends DeferModule[D] with StashModule
trait StashModule extends Module
Companion:
object
Companion:
class
trait StashRestore[S]
Companion:
object
Companion:
class
trait StashToolkit extends Toolkit

When StashToolkit.State is not a persistent data structure, it might still provide a way to remember the current state (as if push on the stack) and return to it later (as if pop off the stack). StashToolkit is a Toolkit that supports such operations on Toolkit.State.

When StashToolkit.State is not a persistent data structure, it might still provide a way to remember the current state (as if push on the stack) and return to it later (as if pop off the stack). StashToolkit is a Toolkit that supports such operations on Toolkit.State.

trait Toolkit

Provides implementations of multiple APIs. The specific APIs provided by a Toolkit are defined in subclasses, such as PropagationToolkit, BranchingToolkit, RelToolkit, etc.

Provides implementations of multiple APIs. The specific APIs provided by a Toolkit are defined in subclasses, such as PropagationToolkit, BranchingToolkit, RelToolkit, etc.

The unifying feature across all provided APIs is that programs written against those APIs can be represented by a type Toolkit.Prg, which is at least a monad. Such programs can be interpreted (Toolkit.interpret) as state transitions on Toolkit.State.