eyg/analysis/inference/levels_j/contextual

Types

pub type Analysis(meta) {
  Analysis(
    bindings: dict.Dict(Int, binding.Binding),
    tree: #(
      tree.Expression(
        #(
          Result(Nil, error.Reason),
          isomorphic.Type(Int),
          isomorphic.Type(Int),
          List(#(String, isomorphic.Type(#(Bool, Int)))),
        ),
      ),
      #(
        Result(Nil, error.Reason),
        isomorphic.Type(Int),
        isomorphic.Type(Int),
        List(#(String, isomorphic.Type(#(Bool, Int)))),
      ),
    ),
    original: #(tree.Expression(meta), meta),
  )
}

Constructors

pub type Context {
  Context(
    env: List(#(String, isomorphic.Type(#(Bool, Int)))),
    eff: isomorphic.Type(Int),
    refs: dict.Dict(v1.Cid, isomorphic.Type(#(Bool, Int))),
    level: Int,
    bindings: dict.Dict(Int, binding.Binding),
  )
}

Constructors

pub type Env =
  List(#(String, isomorphic.Type(#(Bool, Int))))

Values

pub fn all_errors(
  inference: Analysis(meta),
) -> List(#(meta, error.Reason))
pub fn arity_at(
  inference: Analysis(meta),
  desired: meta,
) -> Result(Int, Nil)
pub fn builtins() -> List(
  #(String, isomorphic.Type(#(Bool, Int))),
)
pub fn case_(label: String) -> isomorphic.Type(#(Bool, Int))
pub fn check(
  context: Context,
  source: #(tree.Expression(meta), meta),
) -> Analysis(meta)
pub fn count_args(type_: isomorphic.Type(a)) -> Result(Int, Nil)
pub fn do_infer(
  source: #(tree.Expression(a), a),
  env: List(#(String, isomorphic.Type(#(Bool, Int)))),
  eff: isomorphic.Type(Int),
  refs: dict.Dict(v1.Cid, isomorphic.Type(#(Bool, Int))),
  level: Int,
  bindings: dict.Dict(Int, binding.Binding),
) -> #(
  dict.Dict(Int, binding.Binding),
  isomorphic.Type(Int),
  isomorphic.Type(Int),
  #(
    tree.Expression(
      #(
        Result(Nil, error.Reason),
        isomorphic.Type(Int),
        isomorphic.Type(Int),
        List(#(String, isomorphic.Type(#(Bool, Int)))),
      ),
    ),
    #(
      Result(Nil, error.Reason),
      isomorphic.Type(Int),
      isomorphic.Type(Int),
      List(#(String, isomorphic.Type(#(Bool, Int)))),
    ),
  ),
)
pub fn ftv(type_: isomorphic.Type(a)) -> set.Set(a)
pub fn handle(label: String) -> isomorphic.Type(#(Bool, Int))
pub fn infer(
  source: #(tree.Expression(a), a),
  eff: isomorphic.Type(Int),
  refs: dict.Dict(v1.Cid, isomorphic.Type(#(Bool, Int))),
  level: Int,
  bindings: dict.Dict(Int, binding.Binding),
) -> #(
  #(
    tree.Expression(
      #(
        Result(Nil, error.Reason),
        isomorphic.Type(Int),
        isomorphic.Type(Int),
        List(#(String, isomorphic.Type(#(Bool, Int)))),
      ),
    ),
    #(
      Result(Nil, error.Reason),
      isomorphic.Type(Int),
      isomorphic.Type(Int),
      List(#(String, isomorphic.Type(#(Bool, Int)))),
    ),
  ),
  dict.Dict(Int, binding.Binding),
)
pub fn missing_references(
  inference: Analysis(meta),
) -> List(v1.Cid)
pub fn new_state() -> dict.Dict(a, b)
pub fn nocases() -> isomorphic.Type(#(Bool, Int))
pub fn poly_type(
  inference: Analysis(meta),
) -> isomorphic.Type(#(Bool, Int))
pub fn pure() -> Context

pure creates a new inference context to infer an expression with no effects. Any effect from the expression will be a type error

pub fn q(i: a) -> isomorphic.Type(#(Bool, a))
pub fn scope_at(
  inference: Analysis(meta),
  desired: meta,
) -> Result(List(#(String, isomorphic.Type(#(Bool, Int)))), Nil)
pub fn type_(inference: Analysis(meta)) -> isomorphic.Type(Int)

Returns the top type from the analysis over an expression

pub fn type_at(
  inference: Analysis(meta),
  desired: meta,
) -> Result(isomorphic.Type(Int), Nil)
pub fn unpure() -> Context

unpure creates a new inference context which accepts any effect.

pub fn with_effect(
  context: Context,
  label: String,
  lift: isomorphic.Type(Int),
  lower: isomorphic.Type(Int),
) -> Context
pub fn with_effects(
  context: Context,
  effects: List(
    #(String, #(isomorphic.Type(Int), isomorphic.Type(Int))),
  ),
) -> Context
pub fn with_references(
  context: Context,
  refs: dict.Dict(v1.Cid, isomorphic.Type(#(Bool, Int))),
) -> Context

Pass in a dictionary of reference to types. This dictionary is also used to look up the types of releases by there cid.

Search Document