touch_grass/interface

Types

The harness types concretly implementing the browser harness effect types

pub type Harness(eff, meta) =
  List(Interface(eff, meta))
pub type Interface(eff, meta) {
  Interface(
    name: String,
    lift_type: isomorphic.Type(Int),
    lower_type: isomorphic.Type(Int),
    decode: fn(
      value.Value(
        meta,
        #(List(#(state.Kontinue(meta), meta)), state.Env(meta)),
      ),
    ) -> Result(
      eff,
      break.Reason(
        meta,
        #(List(#(state.Kontinue(meta), meta)), state.Env(meta)),
      ),
    ),
  )
}

Constructors

Values

pub fn cast(
  effects: List(Interface(eff, a)),
  label: String,
  input: value.Value(
    a,
    #(List(#(state.Kontinue(a), a)), state.Env(a)),
  ),
) -> Result(
  eff,
  break.Reason(a, #(List(#(state.Kontinue(a), a)), state.Env(a))),
)

Cast a rasied effect to an effect type in a harness

pub fn take(
  effects: List(Interface(eff, meta)),
  labels: List(String),
) -> List(Interface(eff, meta))

Narrow a harness to a subset of effects.

pub fn types(
  harness: List(Interface(eff, meta)),
) -> List(
  #(String, #(isomorphic.Type(Int), isomorphic.Type(Int))),
)

Get the effect lift and lower types for a harness.

Search Document