Struct simplicity::types::arrow::Arrow
source · pub struct Arrow {
pub source: Type,
pub target: Type,
}Expand description
A container for an expression’s source and target types, whether or not these types are complete.
Fields§
§source: TypeThe source type
target: TypeThe target type
Implementations§
source§impl Arrow
impl Arrow
sourcepub fn finalize(&self) -> Result<FinalArrow, Error>
pub fn finalize(&self) -> Result<FinalArrow, Error>
Finalize the source and target types in the arrow
sourcepub fn for_witness() -> Self
pub fn for_witness() -> Self
Create a unification arrow for a fresh witness combinator
sourcepub fn for_const_word(word: &Value) -> Self
pub fn for_const_word(word: &Value) -> Self
Create a unification arrow for a fresh const-word combinator
sourcepub fn for_injl(child_arrow: &Arrow) -> Self
pub fn for_injl(child_arrow: &Arrow) -> Self
Create a unification arrow for a fresh injl combinator
sourcepub fn for_injr(child_arrow: &Arrow) -> Self
pub fn for_injr(child_arrow: &Arrow) -> Self
Create a unification arrow for a fresh injr combinator
sourcepub fn for_take(child_arrow: &Arrow) -> Self
pub fn for_take(child_arrow: &Arrow) -> Self
Create a unification arrow for a fresh take combinator
sourcepub fn for_drop(child_arrow: &Arrow) -> Self
pub fn for_drop(child_arrow: &Arrow) -> Self
Create a unification arrow for a fresh drop combinator
sourcepub fn for_pair(
lchild_arrow: &Arrow,
rchild_arrow: &Arrow
) -> Result<Self, Error>
pub fn for_pair( lchild_arrow: &Arrow, rchild_arrow: &Arrow ) -> Result<Self, Error>
Create a unification arrow for a fresh pair combinator
sourcepub fn for_comp(
lchild_arrow: &Arrow,
rchild_arrow: &Arrow
) -> Result<Self, Error>
pub fn for_comp( lchild_arrow: &Arrow, rchild_arrow: &Arrow ) -> Result<Self, Error>
Create a unification arrow for a fresh comp combinator
sourcepub fn for_case(
lchild_arrow: Option<&Arrow>,
rchild_arrow: Option<&Arrow>
) -> Result<Self, Error>
pub fn for_case( lchild_arrow: Option<&Arrow>, rchild_arrow: Option<&Arrow> ) -> Result<Self, Error>
Create a unification arrow for a fresh case combinator
Either child may be None, in which case the combinator is assumed to be
an assertion, which for type-inference purposes means there are no bounds
on the missing child.
If neither child is provided, this function will not raise an error; it is the responsibility of the caller to detect this case and error elsewhere.
sourcepub fn for_disconnect(
lchild_arrow: &Arrow,
rchild_arrow: &Arrow
) -> Result<Self, Error>
pub fn for_disconnect( lchild_arrow: &Arrow, rchild_arrow: &Arrow ) -> Result<Self, Error>
Create a unification arrow for a fresh comp combinator
sourcepub fn shallow_clone(&self) -> Self
pub fn shallow_clone(&self) -> Self
Same as Self::clone but named to make it clearer that this is cheap
Trait Implementations§
source§impl CoreConstructible for Arrow
impl CoreConstructible for Arrow
fn iden() -> Self
fn unit() -> Self
fn injl(child: &Self) -> Self
fn injr(child: &Self) -> Self
fn take(child: &Self) -> Self
fn drop_(child: &Self) -> Self
fn comp(left: &Self, right: &Self) -> Result<Self, Error>
fn case(left: &Self, right: &Self) -> Result<Self, Error>
fn assertl(left: &Self, _: Cmr) -> Result<Self, Error>
fn assertr(_: Cmr, right: &Self) -> Result<Self, Error>
fn pair(left: &Self, right: &Self) -> Result<Self, Error>
fn fail(_: FailEntropy) -> Self
fn const_word(word: Arc<Value>) -> Self
source§fn scribe(value: &Value) -> Self
fn scribe(value: &Value) -> Self
value as constant output. Read moresource§fn bit_false() -> Self
fn bit_false() -> Self
0 as constant output. Read moresource§fn bit_true() -> Self
fn bit_true() -> Self
1 as constant output. Read moresource§fn cond(left: &Self, right: &Self) -> Result<Self, Error>
fn cond(left: &Self, right: &Self) -> Result<Self, Error>
left child is evaluated on the input if the bit is 1 (if branch)
and the right child is evaluated on the input otherwise (else branch). Read moresource§fn assert(child: &Self, hash: Cmr) -> Result<Self, Error>
fn assert(child: &Self, hash: Cmr) -> Result<Self, Error>
true, and fails otherwise.
The hash identifies the assertion and is returned upon failure. Read moresource§fn not(child: &Self) -> Result<Self, Error>
fn not(child: &Self) -> Result<Self, Error>
child. Read more