diff --git a/hugr-core/src/hugr/views.rs b/hugr-core/src/hugr/views.rs index aa484bd77..09805d1f8 100644 --- a/hugr-core/src/hugr/views.rs +++ b/hugr-core/src/hugr/views.rs @@ -338,16 +338,8 @@ pub trait HugrView: HugrInternals { self.root_type().inner_function_type() } - /// Returns the function type defined by this HUGR. - /// - /// For HUGRs with a [`DataflowParent`][crate::ops::DataflowParent] root - /// operation, report the signature of the inner dataflow sibling graph. - /// - /// For HUGRS with a [`FuncDecl`][crate::ops::FuncDecl] or - /// [`FuncDefn`][crate::ops::FuncDefn] root operation, report the signature - /// of the function. - /// - /// Otherwise, returns `None`. + /// Returns the function type defined by this HUGR, i.e. `Some` iff the root is + /// a [`FuncDecl`][crate::ops::FuncDecl] or [`FuncDefn`][crate::ops::FuncDefn]. fn poly_func_type(&self) -> Option { match self.root_type() { OpType::FuncDecl(decl) => Some(decl.signature.clone()), diff --git a/hugr-core/src/std_extensions/collections/array/array_op.rs b/hugr-core/src/std_extensions/collections/array/array_op.rs index 2c256880b..197536032 100644 --- a/hugr-core/src/std_extensions/collections/array/array_op.rs +++ b/hugr-core/src/std_extensions/collections/array/array_op.rs @@ -22,15 +22,36 @@ use super::{array_type, array_type_def, ARRAY_TYPENAME}; /// Array operation definitions. #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, EnumIter, IntoStaticStr, EnumString)] -#[allow(non_camel_case_types, missing_docs)] +#[allow(non_camel_case_types)] #[non_exhaustive] pub enum ArrayOpDef { + /// Makes a new array, given distinct inputs equal to its length: + /// `new_array: (elemty)^SIZE -> array` + /// where `SIZE` must be statically known (not a variable) new_array, + /// Copies an element out of the array ([TypeBound::Copyable] elements only): + /// `get: array, index -> option` get, + /// Exchanges an element of the array with an external value: + /// `set: array, index, elemty -> either(elemty, array | elemty, array)` + /// tagged for failure/success respectively set, + /// Exchanges the elements at two indices within the array: + /// `swap: array, index, index -> either(array, array)` + /// tagged for failure/success respectively swap, + /// Separates the leftmost element from the rest of the array: + /// `pop_left: array -> Option>` + /// where `SIZE` must be known statically (not a variable). + /// `None` is returned if the input array was size 0. pop_left, + /// Separates the rightmost element from the rest of the array. + /// `pop_right: array -> Option>` + /// where `SIZE` must be known statically (not a variable). + /// `None` is returned if the input array was size 0. pop_right, + /// Allows discarding a 0-element array of linear type. + /// `discard_empty: array<0, elemty> -> ` (no outputs) discard_empty, }